From 14559d508ffd3d7a5d07369acc441e660826f21a Mon Sep 17 00:00:00 2001 From: lipchev Date: Mon, 21 Sep 2020 02:55:04 +0300 Subject: [PATCH 1/5] Add round-tripping Equality/IComparable contract generation - CompareTo implemented in terms of the two-way comparison between 'this.As(other)' & 'other.As(this)' - Equals changed to CompareTo(other) == 0 - Comparison operators re-written in terms of CompareTo values - GetHashCode generation modified such that it is consistent with the Equals function- i.e. not including the UnitType - Added tests (QuantityComparisonTests) for the IComparable, Equality contracts, including the (previously failing) comparisons with problematic values such as 0.001 --- .../UnitsNetGen/QuantityGenerator.cs | 17 +-- .../UnitsNetGen/UnitTestBaseClassGenerator.cs | 3 +- .../TestsBase/AccelerationTestsBase.g.cs | 3 +- .../TestsBase/AmountOfSubstanceTestsBase.g.cs | 3 +- .../TestsBase/AmplitudeRatioTestsBase.g.cs | 3 +- .../TestsBase/AngleTestsBase.g.cs | 3 +- .../TestsBase/ApparentEnergyTestsBase.g.cs | 3 +- .../TestsBase/ApparentPowerTestsBase.g.cs | 3 +- .../TestsBase/AreaDensityTestsBase.g.cs | 3 +- .../AreaMomentOfInertiaTestsBase.g.cs | 3 +- .../TestsBase/AreaTestsBase.g.cs | 3 +- .../TestsBase/BitRateTestsBase.g.cs | 3 +- ...BrakeSpecificFuelConsumptionTestsBase.g.cs | 3 +- .../TestsBase/CapacitanceTestsBase.g.cs | 3 +- ...oefficientOfThermalExpansionTestsBase.g.cs | 3 +- .../TestsBase/DensityTestsBase.g.cs | 3 +- .../TestsBase/DurationTestsBase.g.cs | 3 +- .../TestsBase/DynamicViscosityTestsBase.g.cs | 3 +- .../ElectricAdmittanceTestsBase.g.cs | 3 +- .../ElectricChargeDensityTestsBase.g.cs | 3 +- .../TestsBase/ElectricChargeTestsBase.g.cs | 3 +- .../ElectricConductanceTestsBase.g.cs | 3 +- .../ElectricConductivityTestsBase.g.cs | 3 +- .../ElectricCurrentDensityTestsBase.g.cs | 3 +- .../ElectricCurrentGradientTestsBase.g.cs | 3 +- .../TestsBase/ElectricCurrentTestsBase.g.cs | 3 +- .../TestsBase/ElectricFieldTestsBase.g.cs | 3 +- .../ElectricInductanceTestsBase.g.cs | 3 +- .../ElectricPotentialAcTestsBase.g.cs | 3 +- .../ElectricPotentialChangeRateTestsBase.g.cs | 3 +- .../ElectricPotentialDcTestsBase.g.cs | 3 +- .../TestsBase/ElectricPotentialTestsBase.g.cs | 3 +- .../ElectricResistanceTestsBase.g.cs | 3 +- .../ElectricResistivityTestsBase.g.cs | 3 +- ...ElectricSurfaceChargeDensityTestsBase.g.cs | 3 +- .../TestsBase/EnergyTestsBase.g.cs | 3 +- .../TestsBase/EntropyTestsBase.g.cs | 3 +- .../TestsBase/ForceChangeRateTestsBase.g.cs | 3 +- .../TestsBase/ForcePerLengthTestsBase.g.cs | 3 +- .../TestsBase/ForceTestsBase.g.cs | 3 +- .../TestsBase/FrequencyTestsBase.g.cs | 3 +- .../TestsBase/FuelEfficiencyTestsBase.g.cs | 3 +- .../TestsBase/HeatFluxTestsBase.g.cs | 3 +- .../HeatTransferCoefficientTestsBase.g.cs | 3 +- .../TestsBase/IlluminanceTestsBase.g.cs | 3 +- .../TestsBase/InformationTestsBase.g.cs | 3 +- .../TestsBase/IrradianceTestsBase.g.cs | 3 +- .../TestsBase/IrradiationTestsBase.g.cs | 3 +- .../KinematicViscosityTestsBase.g.cs | 3 +- .../TestsBase/LapseRateTestsBase.g.cs | 3 +- .../TestsBase/LengthTestsBase.g.cs | 3 +- .../TestsBase/LevelTestsBase.g.cs | 3 +- .../TestsBase/LinearDensityTestsBase.g.cs | 3 +- .../LinearPowerDensityTestsBase.g.cs | 3 +- .../TestsBase/LuminosityTestsBase.g.cs | 3 +- .../TestsBase/LuminousFluxTestsBase.g.cs | 3 +- .../TestsBase/LuminousIntensityTestsBase.g.cs | 3 +- .../TestsBase/MagneticFieldTestsBase.g.cs | 3 +- .../TestsBase/MagneticFluxTestsBase.g.cs | 3 +- .../TestsBase/MagnetizationTestsBase.g.cs | 3 +- .../TestsBase/MassConcentrationTestsBase.g.cs | 3 +- .../TestsBase/MassFlowTestsBase.g.cs | 3 +- .../TestsBase/MassFluxTestsBase.g.cs | 3 +- .../TestsBase/MassFractionTestsBase.g.cs | 3 +- .../MassMomentOfInertiaTestsBase.g.cs | 3 +- .../TestsBase/MassTestsBase.g.cs | 3 +- .../TestsBase/MolarEnergyTestsBase.g.cs | 3 +- .../TestsBase/MolarEntropyTestsBase.g.cs | 3 +- .../TestsBase/MolarMassTestsBase.g.cs | 3 +- .../TestsBase/MolarityTestsBase.g.cs | 3 +- .../TestsBase/PermeabilityTestsBase.g.cs | 3 +- .../TestsBase/PermittivityTestsBase.g.cs | 3 +- .../TestsBase/PowerDensityTestsBase.g.cs | 3 +- .../TestsBase/PowerRatioTestsBase.g.cs | 3 +- .../TestsBase/PowerTestsBase.g.cs | 3 +- .../PressureChangeRateTestsBase.g.cs | 3 +- .../TestsBase/PressureTestsBase.g.cs | 3 +- .../TestsBase/RatioChangeRateTestsBase.g.cs | 3 +- .../TestsBase/RatioTestsBase.g.cs | 3 +- .../TestsBase/ReactiveEnergyTestsBase.g.cs | 3 +- .../TestsBase/ReactivePowerTestsBase.g.cs | 3 +- .../RotationalAccelerationTestsBase.g.cs | 3 +- .../TestsBase/RotationalSpeedTestsBase.g.cs | 3 +- ...RotationalStiffnessPerLengthTestsBase.g.cs | 3 +- .../RotationalStiffnessTestsBase.g.cs | 3 +- .../TestsBase/SolidAngleTestsBase.g.cs | 3 +- .../TestsBase/SpecificEnergyTestsBase.g.cs | 3 +- .../TestsBase/SpecificEntropyTestsBase.g.cs | 3 +- .../TestsBase/SpecificVolumeTestsBase.g.cs | 3 +- .../TestsBase/SpecificWeightTestsBase.g.cs | 3 +- .../TestsBase/SpeedTestsBase.g.cs | 3 +- .../TemperatureChangeRateTestsBase.g.cs | 3 +- .../TestsBase/TemperatureDeltaTestsBase.g.cs | 3 +- .../TestsBase/TemperatureTestsBase.g.cs | 3 +- .../ThermalConductivityTestsBase.g.cs | 3 +- .../TestsBase/ThermalResistanceTestsBase.g.cs | 3 +- .../TestsBase/TorquePerLengthTestsBase.g.cs | 3 +- .../TestsBase/TorqueTestsBase.g.cs | 3 +- .../TestsBase/VitaminATestsBase.g.cs | 3 +- .../VolumeConcentrationTestsBase.g.cs | 3 +- .../TestsBase/VolumeFlowTestsBase.g.cs | 3 +- .../TestsBase/VolumePerLengthTestsBase.g.cs | 3 +- .../TestsBase/VolumeTestsBase.g.cs | 3 +- UnitsNet.Tests/QuantityComparisonTests.cs | 114 ++++++++++++++++++ .../Quantities/Acceleration.g.cs | 17 +-- .../Quantities/AmountOfSubstance.g.cs | 17 +-- .../Quantities/AmplitudeRatio.g.cs | 17 +-- UnitsNet/GeneratedCode/Quantities/Angle.g.cs | 17 +-- .../Quantities/ApparentEnergy.g.cs | 17 +-- .../Quantities/ApparentPower.g.cs | 17 +-- UnitsNet/GeneratedCode/Quantities/Area.g.cs | 17 +-- .../GeneratedCode/Quantities/AreaDensity.g.cs | 17 +-- .../Quantities/AreaMomentOfInertia.g.cs | 17 +-- .../GeneratedCode/Quantities/BitRate.g.cs | 17 +-- .../BrakeSpecificFuelConsumption.g.cs | 17 +-- .../GeneratedCode/Quantities/Capacitance.g.cs | 17 +-- .../CoefficientOfThermalExpansion.g.cs | 17 +-- .../GeneratedCode/Quantities/Density.g.cs | 17 +-- .../GeneratedCode/Quantities/Duration.g.cs | 17 +-- .../Quantities/DynamicViscosity.g.cs | 17 +-- .../Quantities/ElectricAdmittance.g.cs | 17 +-- .../Quantities/ElectricCharge.g.cs | 17 +-- .../Quantities/ElectricChargeDensity.g.cs | 17 +-- .../Quantities/ElectricConductance.g.cs | 17 +-- .../Quantities/ElectricConductivity.g.cs | 17 +-- .../Quantities/ElectricCurrent.g.cs | 17 +-- .../Quantities/ElectricCurrentDensity.g.cs | 17 +-- .../Quantities/ElectricCurrentGradient.g.cs | 17 +-- .../Quantities/ElectricField.g.cs | 17 +-- .../Quantities/ElectricInductance.g.cs | 17 +-- .../Quantities/ElectricPotential.g.cs | 17 +-- .../Quantities/ElectricPotentialAc.g.cs | 17 +-- .../ElectricPotentialChangeRate.g.cs | 17 +-- .../Quantities/ElectricPotentialDc.g.cs | 17 +-- .../Quantities/ElectricResistance.g.cs | 17 +-- .../Quantities/ElectricResistivity.g.cs | 17 +-- .../ElectricSurfaceChargeDensity.g.cs | 17 +-- UnitsNet/GeneratedCode/Quantities/Energy.g.cs | 17 +-- .../GeneratedCode/Quantities/Entropy.g.cs | 17 +-- UnitsNet/GeneratedCode/Quantities/Force.g.cs | 17 +-- .../Quantities/ForceChangeRate.g.cs | 17 +-- .../Quantities/ForcePerLength.g.cs | 17 +-- .../GeneratedCode/Quantities/Frequency.g.cs | 17 +-- .../Quantities/FuelEfficiency.g.cs | 17 +-- .../GeneratedCode/Quantities/HeatFlux.g.cs | 17 +-- .../Quantities/HeatTransferCoefficient.g.cs | 17 +-- .../GeneratedCode/Quantities/Illuminance.g.cs | 17 +-- .../GeneratedCode/Quantities/Information.g.cs | 17 +-- .../GeneratedCode/Quantities/Irradiance.g.cs | 17 +-- .../GeneratedCode/Quantities/Irradiation.g.cs | 17 +-- .../Quantities/KinematicViscosity.g.cs | 17 +-- .../GeneratedCode/Quantities/LapseRate.g.cs | 17 +-- UnitsNet/GeneratedCode/Quantities/Length.g.cs | 17 +-- UnitsNet/GeneratedCode/Quantities/Level.g.cs | 17 +-- .../Quantities/LinearDensity.g.cs | 17 +-- .../Quantities/LinearPowerDensity.g.cs | 17 +-- .../GeneratedCode/Quantities/Luminosity.g.cs | 17 +-- .../Quantities/LuminousFlux.g.cs | 17 +-- .../Quantities/LuminousIntensity.g.cs | 17 +-- .../Quantities/MagneticField.g.cs | 17 +-- .../Quantities/MagneticFlux.g.cs | 17 +-- .../Quantities/Magnetization.g.cs | 17 +-- UnitsNet/GeneratedCode/Quantities/Mass.g.cs | 17 +-- .../Quantities/MassConcentration.g.cs | 17 +-- .../GeneratedCode/Quantities/MassFlow.g.cs | 17 +-- .../GeneratedCode/Quantities/MassFlux.g.cs | 17 +-- .../Quantities/MassFraction.g.cs | 17 +-- .../Quantities/MassMomentOfInertia.g.cs | 17 +-- .../GeneratedCode/Quantities/MolarEnergy.g.cs | 17 +-- .../Quantities/MolarEntropy.g.cs | 17 +-- .../GeneratedCode/Quantities/MolarMass.g.cs | 17 +-- .../GeneratedCode/Quantities/Molarity.g.cs | 17 +-- .../Quantities/Permeability.g.cs | 17 +-- .../Quantities/Permittivity.g.cs | 17 +-- UnitsNet/GeneratedCode/Quantities/Power.g.cs | 17 +-- .../Quantities/PowerDensity.g.cs | 17 +-- .../GeneratedCode/Quantities/PowerRatio.g.cs | 17 +-- .../GeneratedCode/Quantities/Pressure.g.cs | 17 +-- .../Quantities/PressureChangeRate.g.cs | 17 +-- UnitsNet/GeneratedCode/Quantities/Ratio.g.cs | 17 +-- .../Quantities/RatioChangeRate.g.cs | 17 +-- .../Quantities/ReactiveEnergy.g.cs | 17 +-- .../Quantities/ReactivePower.g.cs | 17 +-- .../Quantities/RotationalAcceleration.g.cs | 17 +-- .../Quantities/RotationalSpeed.g.cs | 17 +-- .../Quantities/RotationalStiffness.g.cs | 17 +-- .../RotationalStiffnessPerLength.g.cs | 17 +-- .../GeneratedCode/Quantities/SolidAngle.g.cs | 17 +-- .../Quantities/SpecificEnergy.g.cs | 17 +-- .../Quantities/SpecificEntropy.g.cs | 17 +-- .../Quantities/SpecificVolume.g.cs | 17 +-- .../Quantities/SpecificWeight.g.cs | 17 +-- UnitsNet/GeneratedCode/Quantities/Speed.g.cs | 17 +-- .../GeneratedCode/Quantities/Temperature.g.cs | 17 +-- .../Quantities/TemperatureChangeRate.g.cs | 17 +-- .../Quantities/TemperatureDelta.g.cs | 17 +-- .../Quantities/ThermalConductivity.g.cs | 17 +-- .../Quantities/ThermalResistance.g.cs | 17 +-- UnitsNet/GeneratedCode/Quantities/Torque.g.cs | 17 +-- .../Quantities/TorquePerLength.g.cs | 17 +-- .../GeneratedCode/Quantities/VitaminA.g.cs | 17 +-- UnitsNet/GeneratedCode/Quantities/Volume.g.cs | 17 +-- .../Quantities/VolumeConcentration.g.cs | 17 +-- .../GeneratedCode/Quantities/VolumeFlow.g.cs | 17 +-- .../Quantities/VolumePerLength.g.cs | 17 +-- 205 files changed, 1338 insertions(+), 816 deletions(-) create mode 100644 UnitsNet.Tests/QuantityComparisonTests.cs diff --git a/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs b/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs index 4d3942f9d5..963e9fb5fe 100644 --- a/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs +++ b/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs @@ -668,25 +668,25 @@ private void GenerateEqualityAndComparison() /// Returns true if less or equal to. public static bool operator <=({_quantity.Name} left, {_quantity.Name} right) {{ - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; }} /// Returns true if greater than or equal to. public static bool operator >=({_quantity.Name} left, {_quantity.Name} right) {{ - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; }} /// Returns true if less than. public static bool operator <({_quantity.Name} left, {_quantity.Name} right) {{ - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; }} /// Returns true if greater than. public static bool operator >({_quantity.Name} left, {_quantity.Name} right) {{ - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; }} /// Returns true if exactly equal. @@ -715,7 +715,9 @@ public int CompareTo(object obj) /// public int CompareTo({_quantity.Name} other) {{ - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; }} /// @@ -732,7 +734,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals({_quantity.Name} other) {{ - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; }} /// @@ -792,7 +794,8 @@ public bool Equals({_quantity.Name} other, double tolerance, ComparisonType comp /// A hash code for the current {_quantity.Name}. public override int GetHashCode() {{ - return new {{ QuantityType, Value, Unit }}.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new {{ QuantityType, roundedBaseValue }}.GetHashCode(); }} #endregion diff --git a/CodeGen/Generators/UnitsNetGen/UnitTestBaseClassGenerator.cs b/CodeGen/Generators/UnitsNetGen/UnitTestBaseClassGenerator.cs index 2561a73651..8490838cb6 100644 --- a/CodeGen/Generators/UnitsNetGen/UnitTestBaseClassGenerator.cs +++ b/CodeGen/Generators/UnitsNetGen/UnitTestBaseClassGenerator.cs @@ -643,7 +643,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() {{ var quantity = {_quantity.Name}.From{_baseUnit.PluralName}(1.0); - Assert.Equal(new {{{_quantity.Name}.QuantityType, quantity.Value, quantity.Unit}}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {{{_quantity.Name}.QuantityType, roundedBaseValue}}.GetHashCode(), quantity.GetHashCode()); }} "); diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AccelerationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AccelerationTestsBase.g.cs index a7bfeb7b11..7aa47ff01e 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/AccelerationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AccelerationTestsBase.g.cs @@ -713,7 +713,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Acceleration.FromMetersPerSecondSquared(1.0); - Assert.Equal(new {Acceleration.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {Acceleration.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AmountOfSubstanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AmountOfSubstanceTestsBase.g.cs index a98c19d80d..f443812305 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/AmountOfSubstanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AmountOfSubstanceTestsBase.g.cs @@ -728,7 +728,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = AmountOfSubstance.FromMoles(1.0); - Assert.Equal(new {AmountOfSubstance.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {AmountOfSubstance.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AmplitudeRatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AmplitudeRatioTestsBase.g.cs index 708b250965..6d527a0bcd 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/AmplitudeRatioTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AmplitudeRatioTestsBase.g.cs @@ -567,7 +567,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = AmplitudeRatio.FromDecibelVolts(1.0); - Assert.Equal(new {AmplitudeRatio.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {AmplitudeRatio.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AngleTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AngleTestsBase.g.cs index 0febe024a9..e196378db4 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/AngleTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AngleTestsBase.g.cs @@ -713,7 +713,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Angle.FromDegrees(1.0); - Assert.Equal(new {Angle.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {Angle.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ApparentEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ApparentEnergyTestsBase.g.cs index 4fa051c4f5..131c8b84ad 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ApparentEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ApparentEnergyTestsBase.g.cs @@ -548,7 +548,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ApparentEnergy.FromVoltampereHours(1.0); - Assert.Equal(new {ApparentEnergy.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {ApparentEnergy.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ApparentPowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ApparentPowerTestsBase.g.cs index a26aece968..76f787f3d5 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ApparentPowerTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ApparentPowerTestsBase.g.cs @@ -563,7 +563,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ApparentPower.FromVoltamperes(1.0); - Assert.Equal(new {ApparentPower.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {ApparentPower.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AreaDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AreaDensityTestsBase.g.cs index dddc3a8f76..5b232dbb60 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/AreaDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AreaDensityTestsBase.g.cs @@ -518,7 +518,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = AreaDensity.FromKilogramsPerSquareMeter(1.0); - Assert.Equal(new {AreaDensity.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {AreaDensity.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AreaMomentOfInertiaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AreaMomentOfInertiaTestsBase.g.cs index 2249a49b0a..f472edb6d0 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/AreaMomentOfInertiaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AreaMomentOfInertiaTestsBase.g.cs @@ -593,7 +593,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = AreaMomentOfInertia.FromMetersToTheFourth(1.0); - Assert.Equal(new {AreaMomentOfInertia.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {AreaMomentOfInertia.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AreaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AreaTestsBase.g.cs index 8c75c47491..6cfbfe9e72 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/AreaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AreaTestsBase.g.cs @@ -713,7 +713,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Area.FromSquareMeters(1.0); - Assert.Equal(new {Area.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {Area.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/BitRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/BitRateTestsBase.g.cs index 412db29a2d..820d1b82dc 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/BitRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/BitRateTestsBase.g.cs @@ -861,7 +861,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = BitRate.FromBitsPerSecond(1.0); - Assert.Equal(new {BitRate.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {BitRate.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/BrakeSpecificFuelConsumptionTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/BrakeSpecificFuelConsumptionTestsBase.g.cs index c23cdb9618..42874fe2d0 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/BrakeSpecificFuelConsumptionTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/BrakeSpecificFuelConsumptionTestsBase.g.cs @@ -548,7 +548,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1.0); - Assert.Equal(new {BrakeSpecificFuelConsumption.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {BrakeSpecificFuelConsumption.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/CapacitanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/CapacitanceTestsBase.g.cs index 9d80acb031..829e9af12b 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/CapacitanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/CapacitanceTestsBase.g.cs @@ -608,7 +608,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Capacitance.FromFarads(1.0); - Assert.Equal(new {Capacitance.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {Capacitance.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/CoefficientOfThermalExpansionTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/CoefficientOfThermalExpansionTestsBase.g.cs index ca39d1c031..6efc08654e 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/CoefficientOfThermalExpansionTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/CoefficientOfThermalExpansionTestsBase.g.cs @@ -548,7 +548,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = CoefficientOfThermalExpansion.FromInverseKelvin(1.0); - Assert.Equal(new {CoefficientOfThermalExpansion.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {CoefficientOfThermalExpansion.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/DensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/DensityTestsBase.g.cs index 0e541d999b..f2e8daf328 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/DensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/DensityTestsBase.g.cs @@ -1103,7 +1103,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Density.FromKilogramsPerCubicMeter(1.0); - Assert.Equal(new {Density.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {Density.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/DurationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/DurationTestsBase.g.cs index ec6cd5b9df..854004bc3e 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/DurationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/DurationTestsBase.g.cs @@ -653,7 +653,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Duration.FromSeconds(1.0); - Assert.Equal(new {Duration.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {Duration.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/DynamicViscosityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/DynamicViscosityTestsBase.g.cs index 1165333af8..efc2f5d8c4 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/DynamicViscosityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/DynamicViscosityTestsBase.g.cs @@ -653,7 +653,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = DynamicViscosity.FromNewtonSecondsPerMeterSquared(1.0); - Assert.Equal(new {DynamicViscosity.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {DynamicViscosity.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricAdmittanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricAdmittanceTestsBase.g.cs index 2b0a035135..35392f75e7 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricAdmittanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricAdmittanceTestsBase.g.cs @@ -563,7 +563,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ElectricAdmittance.FromSiemens(1.0); - Assert.Equal(new {ElectricAdmittance.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {ElectricAdmittance.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeDensityTestsBase.g.cs index 0b0a1a8b91..1ab12065b5 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeDensityTestsBase.g.cs @@ -518,7 +518,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ElectricChargeDensity.FromCoulombsPerCubicMeter(1.0); - Assert.Equal(new {ElectricChargeDensity.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {ElectricChargeDensity.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeTestsBase.g.cs index 6758d3fcea..040c055d86 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeTestsBase.g.cs @@ -578,7 +578,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ElectricCharge.FromCoulombs(1.0); - Assert.Equal(new {ElectricCharge.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {ElectricCharge.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductanceTestsBase.g.cs index 910069f4c3..908eff309b 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductanceTestsBase.g.cs @@ -548,7 +548,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ElectricConductance.FromSiemens(1.0); - Assert.Equal(new {ElectricConductance.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {ElectricConductance.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductivityTestsBase.g.cs index ecfc40aa40..8dbee97d5a 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductivityTestsBase.g.cs @@ -548,7 +548,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ElectricConductivity.FromSiemensPerMeter(1.0); - Assert.Equal(new {ElectricConductivity.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {ElectricConductivity.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentDensityTestsBase.g.cs index fe9de9d9ea..46a6e1e857 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentDensityTestsBase.g.cs @@ -548,7 +548,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ElectricCurrentDensity.FromAmperesPerSquareMeter(1.0); - Assert.Equal(new {ElectricCurrentDensity.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {ElectricCurrentDensity.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentGradientTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentGradientTestsBase.g.cs index 95314e1e5e..ef59a72d24 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentGradientTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentGradientTestsBase.g.cs @@ -518,7 +518,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ElectricCurrentGradient.FromAmperesPerSecond(1.0); - Assert.Equal(new {ElectricCurrentGradient.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {ElectricCurrentGradient.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentTestsBase.g.cs index 317bf286b1..65c609270e 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentTestsBase.g.cs @@ -623,7 +623,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ElectricCurrent.FromAmperes(1.0); - Assert.Equal(new {ElectricCurrent.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {ElectricCurrent.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricFieldTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricFieldTestsBase.g.cs index 6c1a712012..21ce06049a 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricFieldTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricFieldTestsBase.g.cs @@ -518,7 +518,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ElectricField.FromVoltsPerMeter(1.0); - Assert.Equal(new {ElectricField.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {ElectricField.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricInductanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricInductanceTestsBase.g.cs index 12c90919fc..c32c967a10 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricInductanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricInductanceTestsBase.g.cs @@ -563,7 +563,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ElectricInductance.FromHenries(1.0); - Assert.Equal(new {ElectricInductance.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {ElectricInductance.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialAcTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialAcTestsBase.g.cs index ca27c93970..d50a31da7d 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialAcTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialAcTestsBase.g.cs @@ -578,7 +578,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ElectricPotentialAc.FromVoltsAc(1.0); - Assert.Equal(new {ElectricPotentialAc.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {ElectricPotentialAc.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialChangeRateTestsBase.g.cs index 9bea7822d6..96ff12813b 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialChangeRateTestsBase.g.cs @@ -803,7 +803,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ElectricPotentialChangeRate.FromVoltsPerSeconds(1.0); - Assert.Equal(new {ElectricPotentialChangeRate.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {ElectricPotentialChangeRate.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialDcTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialDcTestsBase.g.cs index ef1b6a2d63..20f8445002 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialDcTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialDcTestsBase.g.cs @@ -578,7 +578,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ElectricPotentialDc.FromVoltsDc(1.0); - Assert.Equal(new {ElectricPotentialDc.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {ElectricPotentialDc.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialTestsBase.g.cs index c984d21229..272aea5bdd 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialTestsBase.g.cs @@ -578,7 +578,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ElectricPotential.FromVolts(1.0); - Assert.Equal(new {ElectricPotential.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {ElectricPotential.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistanceTestsBase.g.cs index 2176bc6587..8b1a813669 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistanceTestsBase.g.cs @@ -593,7 +593,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ElectricResistance.FromOhms(1.0); - Assert.Equal(new {ElectricResistance.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {ElectricResistance.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistivityTestsBase.g.cs index 88ff7e8500..9b3f6b4b06 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistivityTestsBase.g.cs @@ -713,7 +713,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ElectricResistivity.FromOhmMeters(1.0); - Assert.Equal(new {ElectricResistivity.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {ElectricResistivity.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricSurfaceChargeDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricSurfaceChargeDensityTestsBase.g.cs index c7a52e7880..189d4861f0 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricSurfaceChargeDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricSurfaceChargeDensityTestsBase.g.cs @@ -548,7 +548,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(1.0); - Assert.Equal(new {ElectricSurfaceChargeDensity.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {ElectricSurfaceChargeDensity.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/EnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/EnergyTestsBase.g.cs index 50bc4b5c24..4c4e8fd990 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/EnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/EnergyTestsBase.g.cs @@ -1043,7 +1043,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Energy.FromJoules(1.0); - Assert.Equal(new {Energy.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {Energy.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/EntropyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/EntropyTestsBase.g.cs index dd87f6ab7a..a5d545d675 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/EntropyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/EntropyTestsBase.g.cs @@ -608,7 +608,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Entropy.FromJoulesPerKelvin(1.0); - Assert.Equal(new {Entropy.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {Entropy.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ForceChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ForceChangeRateTestsBase.g.cs index 548df4c745..bccad81618 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ForceChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ForceChangeRateTestsBase.g.cs @@ -668,7 +668,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ForceChangeRate.FromNewtonsPerSecond(1.0); - Assert.Equal(new {ForceChangeRate.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {ForceChangeRate.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ForcePerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ForcePerLengthTestsBase.g.cs index 51626b8468..0aac5ff592 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ForcePerLengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ForcePerLengthTestsBase.g.cs @@ -1073,7 +1073,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ForcePerLength.FromNewtonsPerMeter(1.0); - Assert.Equal(new {ForcePerLength.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {ForcePerLength.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ForceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ForceTestsBase.g.cs index 9689367bb5..6c8329846a 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ForceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ForceTestsBase.g.cs @@ -728,7 +728,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Force.FromNewtons(1.0); - Assert.Equal(new {Force.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {Force.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/FrequencyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/FrequencyTestsBase.g.cs index a73055bce6..ec227e9f89 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/FrequencyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/FrequencyTestsBase.g.cs @@ -653,7 +653,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Frequency.FromHertz(1.0); - Assert.Equal(new {Frequency.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {Frequency.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/FuelEfficiencyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/FuelEfficiencyTestsBase.g.cs index 1e7d191669..7515fe4551 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/FuelEfficiencyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/FuelEfficiencyTestsBase.g.cs @@ -563,7 +563,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = FuelEfficiency.FromLitersPer100Kilometers(1.0); - Assert.Equal(new {FuelEfficiency.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {FuelEfficiency.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/HeatFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/HeatFluxTestsBase.g.cs index 3fbffc36a7..62c5d33e73 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/HeatFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/HeatFluxTestsBase.g.cs @@ -773,7 +773,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = HeatFlux.FromWattsPerSquareMeter(1.0); - Assert.Equal(new {HeatFlux.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {HeatFlux.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/HeatTransferCoefficientTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/HeatTransferCoefficientTestsBase.g.cs index da082abe14..94cb15c74f 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/HeatTransferCoefficientTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/HeatTransferCoefficientTestsBase.g.cs @@ -548,7 +548,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1.0); - Assert.Equal(new {HeatTransferCoefficient.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {HeatTransferCoefficient.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/IlluminanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/IlluminanceTestsBase.g.cs index 9476f78b1e..855f6572d9 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/IlluminanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/IlluminanceTestsBase.g.cs @@ -563,7 +563,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Illuminance.FromLux(1.0); - Assert.Equal(new {Illuminance.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {Illuminance.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/InformationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/InformationTestsBase.g.cs index 1e63906500..ef6f4b4e72 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/InformationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/InformationTestsBase.g.cs @@ -861,7 +861,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Information.FromBits(1.0); - Assert.Equal(new {Information.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {Information.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/IrradianceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/IrradianceTestsBase.g.cs index 2761d2f34b..972cf4c0f3 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/IrradianceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/IrradianceTestsBase.g.cs @@ -713,7 +713,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Irradiance.FromWattsPerSquareMeter(1.0); - Assert.Equal(new {Irradiance.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {Irradiance.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/IrradiationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/IrradiationTestsBase.g.cs index 212a5f8ec2..8ca09d4ef2 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/IrradiationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/IrradiationTestsBase.g.cs @@ -608,7 +608,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Irradiation.FromJoulesPerSquareMeter(1.0); - Assert.Equal(new {Irradiation.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {Irradiation.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/KinematicViscosityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/KinematicViscosityTestsBase.g.cs index b3ec7fef99..3643d66503 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/KinematicViscosityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/KinematicViscosityTestsBase.g.cs @@ -623,7 +623,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = KinematicViscosity.FromSquareMetersPerSecond(1.0); - Assert.Equal(new {KinematicViscosity.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {KinematicViscosity.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LapseRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LapseRateTestsBase.g.cs index fd006236d2..bdf1f683e4 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LapseRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LapseRateTestsBase.g.cs @@ -518,7 +518,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = LapseRate.FromDegreesCelciusPerKilometer(1.0); - Assert.Equal(new {LapseRate.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {LapseRate.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LengthTestsBase.g.cs index 695b44d3f9..5ac8089f6d 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LengthTestsBase.g.cs @@ -998,7 +998,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Length.FromMeters(1.0); - Assert.Equal(new {Length.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {Length.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LevelTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LevelTestsBase.g.cs index 8bd8f79de0..c2d58e36da 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LevelTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LevelTestsBase.g.cs @@ -537,7 +537,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Level.FromDecibels(1.0); - Assert.Equal(new {Level.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {Level.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LinearDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LinearDensityTestsBase.g.cs index 01a64a5151..eb129ca527 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LinearDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LinearDensityTestsBase.g.cs @@ -713,7 +713,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = LinearDensity.FromKilogramsPerMeter(1.0); - Assert.Equal(new {LinearDensity.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {LinearDensity.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LinearPowerDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LinearPowerDensityTestsBase.g.cs index d13e557ff5..4ea6a2168b 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LinearPowerDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LinearPowerDensityTestsBase.g.cs @@ -878,7 +878,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = LinearPowerDensity.FromWattsPerMeter(1.0); - Assert.Equal(new {LinearPowerDensity.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {LinearPowerDensity.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminosityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminosityTestsBase.g.cs index 4c6bbef389..f27fcdcd30 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminosityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminosityTestsBase.g.cs @@ -713,7 +713,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Luminosity.FromWatts(1.0); - Assert.Equal(new {Luminosity.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {Luminosity.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousFluxTestsBase.g.cs index 8e5c85740d..730f65487a 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousFluxTestsBase.g.cs @@ -518,7 +518,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = LuminousFlux.FromLumens(1.0); - Assert.Equal(new {LuminousFlux.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {LuminousFlux.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousIntensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousIntensityTestsBase.g.cs index d1d9a354b5..e4cf57dc90 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousIntensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousIntensityTestsBase.g.cs @@ -518,7 +518,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = LuminousIntensity.FromCandela(1.0); - Assert.Equal(new {LuminousIntensity.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {LuminousIntensity.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFieldTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFieldTestsBase.g.cs index 334fb7b3ad..2781f6a6f1 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFieldTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFieldTestsBase.g.cs @@ -563,7 +563,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = MagneticField.FromTeslas(1.0); - Assert.Equal(new {MagneticField.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {MagneticField.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFluxTestsBase.g.cs index 461fedc57d..07539b584c 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFluxTestsBase.g.cs @@ -518,7 +518,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = MagneticFlux.FromWebers(1.0); - Assert.Equal(new {MagneticFlux.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {MagneticFlux.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MagnetizationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MagnetizationTestsBase.g.cs index 95f91dccf6..832a09d2ba 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MagnetizationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MagnetizationTestsBase.g.cs @@ -518,7 +518,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Magnetization.FromAmperesPerMeter(1.0); - Assert.Equal(new {Magnetization.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {Magnetization.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MassConcentrationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MassConcentrationTestsBase.g.cs index 2d87cf25c6..e22b3ca1b2 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MassConcentrationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MassConcentrationTestsBase.g.cs @@ -1103,7 +1103,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = MassConcentration.FromKilogramsPerCubicMeter(1.0); - Assert.Equal(new {MassConcentration.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {MassConcentration.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MassFlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MassFlowTestsBase.g.cs index 5e4f903ecc..7220845dee 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MassFlowTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MassFlowTestsBase.g.cs @@ -998,7 +998,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = MassFlow.FromGramsPerSecond(1.0); - Assert.Equal(new {MassFlow.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {MassFlow.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MassFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MassFluxTestsBase.g.cs index 98c2f6c2c8..b4129d3a67 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MassFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MassFluxTestsBase.g.cs @@ -683,7 +683,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = MassFlux.FromKilogramsPerSecondPerSquareMeter(1.0); - Assert.Equal(new {MassFlux.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {MassFlux.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MassFractionTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MassFractionTestsBase.g.cs index 3d38e4fec8..6d640b7716 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MassFractionTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MassFractionTestsBase.g.cs @@ -863,7 +863,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = MassFraction.FromDecimalFractions(1.0); - Assert.Equal(new {MassFraction.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {MassFraction.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MassMomentOfInertiaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MassMomentOfInertiaTestsBase.g.cs index 2b8a75b0c7..1e5f775c65 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MassMomentOfInertiaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MassMomentOfInertiaTestsBase.g.cs @@ -923,7 +923,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = MassMomentOfInertia.FromKilogramSquareMeters(1.0); - Assert.Equal(new {MassMomentOfInertia.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {MassMomentOfInertia.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MassTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MassTestsBase.g.cs index d3e6c78afc..6bf53ebf5a 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MassTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MassTestsBase.g.cs @@ -878,7 +878,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Mass.FromKilograms(1.0); - Assert.Equal(new {Mass.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {Mass.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEnergyTestsBase.g.cs index 3950ef38e4..093b44970f 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEnergyTestsBase.g.cs @@ -548,7 +548,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = MolarEnergy.FromJoulesPerMole(1.0); - Assert.Equal(new {MolarEnergy.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {MolarEnergy.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEntropyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEntropyTestsBase.g.cs index 61f6d59220..f447092eb3 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEntropyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEntropyTestsBase.g.cs @@ -548,7 +548,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = MolarEntropy.FromJoulesPerMoleKelvin(1.0); - Assert.Equal(new {MolarEntropy.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {MolarEntropy.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarMassTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarMassTestsBase.g.cs index 64eaf2504e..2335d0a4bb 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarMassTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarMassTestsBase.g.cs @@ -683,7 +683,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = MolarMass.FromKilogramsPerMole(1.0); - Assert.Equal(new {MolarMass.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {MolarMass.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarityTestsBase.g.cs index 5379595111..bc6fd40614 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarityTestsBase.g.cs @@ -623,7 +623,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Molarity.FromMolesPerCubicMeter(1.0); - Assert.Equal(new {Molarity.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {Molarity.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PermeabilityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PermeabilityTestsBase.g.cs index fe2da572fb..55015cda0b 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/PermeabilityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PermeabilityTestsBase.g.cs @@ -518,7 +518,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Permeability.FromHenriesPerMeter(1.0); - Assert.Equal(new {Permeability.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {Permeability.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PermittivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PermittivityTestsBase.g.cs index ca601bf52a..9061a266f2 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/PermittivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PermittivityTestsBase.g.cs @@ -518,7 +518,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Permittivity.FromFaradsPerMeter(1.0); - Assert.Equal(new {Permittivity.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {Permittivity.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PowerDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PowerDensityTestsBase.g.cs index e3ec3d1386..e653fcb336 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/PowerDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PowerDensityTestsBase.g.cs @@ -1163,7 +1163,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = PowerDensity.FromWattsPerCubicMeter(1.0); - Assert.Equal(new {PowerDensity.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {PowerDensity.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PowerRatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PowerRatioTestsBase.g.cs index 6e396fa839..97af4f8780 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/PowerRatioTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PowerRatioTestsBase.g.cs @@ -537,7 +537,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = PowerRatio.FromDecibelWatts(1.0); - Assert.Equal(new {PowerRatio.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {PowerRatio.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PowerTestsBase.g.cs index 50cd2cb275..f5030fc965 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/PowerTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PowerTestsBase.g.cs @@ -846,7 +846,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Power.FromWatts(1.0); - Assert.Equal(new {Power.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {Power.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PressureChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PressureChangeRateTestsBase.g.cs index f0a131094a..cfe2790a48 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/PressureChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PressureChangeRateTestsBase.g.cs @@ -608,7 +608,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = PressureChangeRate.FromPascalsPerSecond(1.0); - Assert.Equal(new {PressureChangeRate.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {PressureChangeRate.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PressureTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PressureTestsBase.g.cs index 8651214baa..e87f994dc3 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/PressureTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PressureTestsBase.g.cs @@ -1133,7 +1133,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Pressure.FromPascals(1.0); - Assert.Equal(new {Pressure.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {Pressure.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RatioChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RatioChangeRateTestsBase.g.cs index 634226dd3b..35fd27f700 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RatioChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RatioChangeRateTestsBase.g.cs @@ -533,7 +533,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = RatioChangeRate.FromDecimalFractionsPerSecond(1.0); - Assert.Equal(new {RatioChangeRate.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {RatioChangeRate.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RatioTestsBase.g.cs index 3eae28326a..c5a5d25d23 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RatioTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RatioTestsBase.g.cs @@ -593,7 +593,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Ratio.FromDecimalFractions(1.0); - Assert.Equal(new {Ratio.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {Ratio.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ReactiveEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ReactiveEnergyTestsBase.g.cs index 9eb8376660..c742b26060 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ReactiveEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ReactiveEnergyTestsBase.g.cs @@ -548,7 +548,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ReactiveEnergy.FromVoltampereReactiveHours(1.0); - Assert.Equal(new {ReactiveEnergy.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {ReactiveEnergy.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ReactivePowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ReactivePowerTestsBase.g.cs index 43ad08f7e5..82cec2ab4a 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ReactivePowerTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ReactivePowerTestsBase.g.cs @@ -563,7 +563,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ReactivePower.FromVoltamperesReactive(1.0); - Assert.Equal(new {ReactivePower.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {ReactivePower.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalAccelerationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalAccelerationTestsBase.g.cs index d253c9abcf..a61156f44e 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalAccelerationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalAccelerationTestsBase.g.cs @@ -563,7 +563,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = RotationalAcceleration.FromRadiansPerSecondSquared(1.0); - Assert.Equal(new {RotationalAcceleration.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {RotationalAcceleration.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalSpeedTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalSpeedTestsBase.g.cs index 3c299b7771..5ed0c0c524 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalSpeedTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalSpeedTestsBase.g.cs @@ -698,7 +698,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = RotationalSpeed.FromRadiansPerSecond(1.0); - Assert.Equal(new {RotationalSpeed.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {RotationalSpeed.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessPerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessPerLengthTestsBase.g.cs index 051f000328..cd53a1a379 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessPerLengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessPerLengthTestsBase.g.cs @@ -578,7 +578,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1.0); - Assert.Equal(new {RotationalStiffnessPerLength.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {RotationalStiffnessPerLength.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessTestsBase.g.cs index 99df23a76b..c47a7b34d4 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessTestsBase.g.cs @@ -998,7 +998,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = RotationalStiffness.FromNewtonMetersPerRadian(1.0); - Assert.Equal(new {RotationalStiffness.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {RotationalStiffness.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/SolidAngleTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/SolidAngleTestsBase.g.cs index c74314396d..54662a72b3 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/SolidAngleTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/SolidAngleTestsBase.g.cs @@ -518,7 +518,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = SolidAngle.FromSteradians(1.0); - Assert.Equal(new {SolidAngle.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {SolidAngle.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEnergyTestsBase.g.cs index 26758681b1..6a44de8003 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEnergyTestsBase.g.cs @@ -878,7 +878,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = SpecificEnergy.FromJoulesPerKilogram(1.0); - Assert.Equal(new {SpecificEnergy.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {SpecificEnergy.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEntropyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEntropyTestsBase.g.cs index 42e3875924..ff28fe14ed 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEntropyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEntropyTestsBase.g.cs @@ -638,7 +638,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = SpecificEntropy.FromJoulesPerKilogramKelvin(1.0); - Assert.Equal(new {SpecificEntropy.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {SpecificEntropy.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificVolumeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificVolumeTestsBase.g.cs index 78bbf330e8..3d1d4dbbe5 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificVolumeTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificVolumeTestsBase.g.cs @@ -548,7 +548,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = SpecificVolume.FromCubicMetersPerKilogram(1.0); - Assert.Equal(new {SpecificVolume.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {SpecificVolume.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificWeightTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificWeightTestsBase.g.cs index b4ffa0649f..3f17675495 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificWeightTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificWeightTestsBase.g.cs @@ -758,7 +758,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = SpecificWeight.FromNewtonsPerCubicMeter(1.0); - Assert.Equal(new {SpecificWeight.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {SpecificWeight.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/SpeedTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/SpeedTestsBase.g.cs index ca618db312..45d828abfa 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/SpeedTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/SpeedTestsBase.g.cs @@ -983,7 +983,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Speed.FromMetersPerSecond(1.0); - Assert.Equal(new {Speed.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {Speed.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureChangeRateTestsBase.g.cs index bcf8f66f5e..fd456c5965 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureChangeRateTestsBase.g.cs @@ -653,7 +653,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = TemperatureChangeRate.FromDegreesCelsiusPerSecond(1.0); - Assert.Equal(new {TemperatureChangeRate.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {TemperatureChangeRate.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureDeltaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureDeltaTestsBase.g.cs index 701405483b..9403137b93 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureDeltaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureDeltaTestsBase.g.cs @@ -638,7 +638,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = TemperatureDelta.FromKelvins(1.0); - Assert.Equal(new {TemperatureDelta.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {TemperatureDelta.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureTestsBase.g.cs index 15bebb3f2d..660398ceb9 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureTestsBase.g.cs @@ -641,7 +641,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Temperature.FromKelvins(1.0); - Assert.Equal(new {Temperature.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {Temperature.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } } diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalConductivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalConductivityTestsBase.g.cs index e333aa2023..127c0cc775 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalConductivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalConductivityTestsBase.g.cs @@ -533,7 +533,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ThermalConductivity.FromWattsPerMeterKelvin(1.0); - Assert.Equal(new {ThermalConductivity.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {ThermalConductivity.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalResistanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalResistanceTestsBase.g.cs index fb86d52699..1351b8b51d 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalResistanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalResistanceTestsBase.g.cs @@ -578,7 +578,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1.0); - Assert.Equal(new {ThermalResistance.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {ThermalResistance.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/TorquePerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/TorquePerLengthTestsBase.g.cs index f5bfc4c2de..d74db2e6e2 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/TorquePerLengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/TorquePerLengthTestsBase.g.cs @@ -818,7 +818,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = TorquePerLength.FromNewtonMetersPerMeter(1.0); - Assert.Equal(new {TorquePerLength.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {TorquePerLength.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/TorqueTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/TorqueTestsBase.g.cs index 9c641c3f06..03cd44c36f 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/TorqueTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/TorqueTestsBase.g.cs @@ -818,7 +818,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Torque.FromNewtonMeters(1.0); - Assert.Equal(new {Torque.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {Torque.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VitaminATestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VitaminATestsBase.g.cs index b54ba26f2d..e88fe299e3 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/VitaminATestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VitaminATestsBase.g.cs @@ -518,7 +518,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = VitaminA.FromInternationalUnits(1.0); - Assert.Equal(new {VitaminA.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {VitaminA.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeConcentrationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeConcentrationTestsBase.g.cs index 60cfa492d2..084dbe4071 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeConcentrationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeConcentrationTestsBase.g.cs @@ -803,7 +803,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = VolumeConcentration.FromDecimalFractions(1.0); - Assert.Equal(new {VolumeConcentration.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {VolumeConcentration.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowTestsBase.g.cs index 7b02e1cc04..073429397e 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowTestsBase.g.cs @@ -1238,7 +1238,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = VolumeFlow.FromCubicMetersPerSecond(1.0); - Assert.Equal(new {VolumeFlow.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {VolumeFlow.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumePerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumePerLengthTestsBase.g.cs index 4db337c2be..d1901192f6 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumePerLengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumePerLengthTestsBase.g.cs @@ -608,7 +608,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = VolumePerLength.FromCubicMetersPerMeter(1.0); - Assert.Equal(new {VolumePerLength.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {VolumePerLength.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeTestsBase.g.cs index c62321d6a3..f691b970b7 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeTestsBase.g.cs @@ -1268,7 +1268,8 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Volume.FromCubicMeters(1.0); - Assert.Equal(new {Volume.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); + Assert.Equal(new {Volume.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/QuantityComparisonTests.cs b/UnitsNet.Tests/QuantityComparisonTests.cs new file mode 100644 index 0000000000..4a9f4befbe --- /dev/null +++ b/UnitsNet.Tests/QuantityComparisonTests.cs @@ -0,0 +1,114 @@ +using System; +using System.Collections.Generic; +using UnitsNet.Units; +using Xunit; + +namespace UnitsNet.Tests +{ + public class QuantityComparisonTests + { + [Fact] + public void CompareTo_WithSameQuantityInAnotherUnit_ReturnsZero() + { + var firstMass = Mass.FromGrams(0.001); + var secondMass = firstMass.ToUnit(MassUnit.Microgram); + + Assert.Equal(0, firstMass.CompareTo(secondMass)); + Assert.Equal(0, secondMass.CompareTo(firstMass)); + } + + [Fact] + public void CompareTo_WithVeryCloseQuantity_ReturnsNonZero() + { + var firstMass = Mass.FromGrams(0); + var secondMass = Mass.FromGrams(double.Epsilon); + + Assert.Equal(-1, firstMass.CompareTo(secondMass)); + Assert.Equal(1, secondMass.CompareTo(firstMass)); + } + + [Fact] + public void Equals_WithSameQuantityInAnotherUnit_ReturnsTrue() + { + var firstMass = Mass.FromGrams(0.001); + var secondMass = firstMass.ToUnit(MassUnit.Microgram); + + Assert.Equal(firstMass, secondMass); + Assert.Equal(secondMass, firstMass); + } + + [Fact] + public void Equals_WithVeryCloseQuantityInSameUnit_ReturnsFalse() + { + var firstMass = Mass.FromGrams(0); + var secondMass = Mass.FromGrams(double.Epsilon); + + Assert.NotEqual(firstMass, secondMass); + Assert.NotEqual(secondMass, firstMass); + } + + [Fact] + public void GetHasCode_WithSameQuantityInAnotherUnit_ReturnsSameValue() + { + var firstMass = Mass.FromGrams(0.001); + var secondMass = firstMass.ToUnit(MassUnit.Microgram); + + Assert.Equal(firstMass.GetHashCode(), secondMass.GetHashCode()); + } + + [Fact] + public void GetHasCode_WithVeryCloseQuantities_ReturnsSameValue() + { + var firstMass = Mass.FromGrams(0); + var secondMass = Mass.FromGrams(double.Epsilon); + + Assert.Equal(firstMass.GetHashCode(), secondMass.GetHashCode()); + } + + [Fact] + public void Contains_CollectionWithMixedUnits_ReturnsTrueIfValuesAreStrictlyEqual() + { + var firstMass = Mass.FromGrams(0.001); + var secondMass = firstMass.ToUnit(MassUnit.Microgram); + + var collection = new HashSet {firstMass}; + + Assert.Contains(firstMass, collection); + Assert.Contains(secondMass, collection); + } + + [Fact] + public void Contains_CollectionWithVeryCloseQuantities_ReturnsTrueIfValuesAreStrictlyEqual() + { + var firstMass = Mass.FromGrams(0); + var secondMass = Mass.FromGrams(double.Epsilon); + + var collection = new HashSet {firstMass}; + + // equal hash codes do not imply object equality + Assert.Equal(firstMass.GetHashCode(), secondMass.GetHashCode()); + Assert.NotEqual(firstMass, secondMass); + + // Contains first checks HashCode, followed by Equals check + Assert.Contains(firstMass, collection); + Assert.DoesNotContain(secondMass, collection); + } + + [Fact] + public void Sort_CollectionWithMixedUnits_SortedByNaturalOrder() + { + var firstMass = Mass.FromGrams(0); + var secondMass = Mass.FromGrams(double.Epsilon); + var thirdMass = Mass.FromGrams(0.001); + var fourthMass = thirdMass.ToUnit(MassUnit.Microgram); + + var collection = new[] {thirdMass, firstMass, fourthMass, secondMass}; + Array.Sort(collection); + + Assert.Equal(firstMass, collection[0]); + Assert.Equal(secondMass, collection[1]); + Assert.Equal(thirdMass, collection[2]); + Assert.Equal(fourthMass, collection[3]); + } + } +} diff --git a/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs b/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs index c06cff33b4..9033a92cbc 100644 --- a/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs @@ -612,25 +612,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Accel /// Returns true if less or equal to. public static bool operator <=(Acceleration left, Acceleration right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(Acceleration left, Acceleration right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(Acceleration left, Acceleration right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(Acceleration left, Acceleration right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -659,7 +659,9 @@ public int CompareTo(object obj) /// public int CompareTo(Acceleration other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -676,7 +678,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Acceleration other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -736,7 +738,8 @@ public bool Equals(Acceleration other, double tolerance, ComparisonType comparis /// A hash code for the current Acceleration. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs index 94b3ca9fd8..b1f936a4b1 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs @@ -627,25 +627,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Amoun /// Returns true if less or equal to. public static bool operator <=(AmountOfSubstance left, AmountOfSubstance right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(AmountOfSubstance left, AmountOfSubstance right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(AmountOfSubstance left, AmountOfSubstance right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(AmountOfSubstance left, AmountOfSubstance right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -674,7 +674,9 @@ public int CompareTo(object obj) /// public int CompareTo(AmountOfSubstance other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -691,7 +693,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(AmountOfSubstance other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -751,7 +753,8 @@ public bool Equals(AmountOfSubstance other, double tolerance, ComparisonType com /// A hash code for the current AmountOfSubstance. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs index 899d516ff6..ae5c151236 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs @@ -470,25 +470,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Ampli /// Returns true if less or equal to. public static bool operator <=(AmplitudeRatio left, AmplitudeRatio right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(AmplitudeRatio left, AmplitudeRatio right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(AmplitudeRatio left, AmplitudeRatio right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(AmplitudeRatio left, AmplitudeRatio right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -517,7 +517,9 @@ public int CompareTo(object obj) /// public int CompareTo(AmplitudeRatio other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -534,7 +536,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(AmplitudeRatio other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -594,7 +596,8 @@ public bool Equals(AmplitudeRatio other, double tolerance, ComparisonType compar /// A hash code for the current AmplitudeRatio. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Angle.g.cs b/UnitsNet/GeneratedCode/Quantities/Angle.g.cs index 7299ad8473..5d88488e68 100644 --- a/UnitsNet/GeneratedCode/Quantities/Angle.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Angle.g.cs @@ -612,25 +612,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Angle /// Returns true if less or equal to. public static bool operator <=(Angle left, Angle right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(Angle left, Angle right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(Angle left, Angle right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(Angle left, Angle right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -659,7 +659,9 @@ public int CompareTo(object obj) /// public int CompareTo(Angle other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -676,7 +678,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Angle other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -736,7 +738,8 @@ public bool Equals(Angle other, double tolerance, ComparisonType comparisonType) /// A hash code for the current Angle. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs index 895523d500..a3945f82b6 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs @@ -447,25 +447,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Appar /// Returns true if less or equal to. public static bool operator <=(ApparentEnergy left, ApparentEnergy right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(ApparentEnergy left, ApparentEnergy right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(ApparentEnergy left, ApparentEnergy right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(ApparentEnergy left, ApparentEnergy right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -494,7 +494,9 @@ public int CompareTo(object obj) /// public int CompareTo(ApparentEnergy other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -511,7 +513,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ApparentEnergy other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -571,7 +573,8 @@ public bool Equals(ApparentEnergy other, double tolerance, ComparisonType compar /// A hash code for the current ApparentEnergy. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs index 269c94cd4d..be8b2f6a98 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs @@ -462,25 +462,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Appar /// Returns true if less or equal to. public static bool operator <=(ApparentPower left, ApparentPower right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(ApparentPower left, ApparentPower right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(ApparentPower left, ApparentPower right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(ApparentPower left, ApparentPower right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -509,7 +509,9 @@ public int CompareTo(object obj) /// public int CompareTo(ApparentPower other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -526,7 +528,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ApparentPower other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -586,7 +588,8 @@ public bool Equals(ApparentPower other, double tolerance, ComparisonType compari /// A hash code for the current ApparentPower. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Area.g.cs b/UnitsNet/GeneratedCode/Quantities/Area.g.cs index d5f3d94ed7..4dae298a3a 100644 --- a/UnitsNet/GeneratedCode/Quantities/Area.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Area.g.cs @@ -612,25 +612,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out AreaU /// Returns true if less or equal to. public static bool operator <=(Area left, Area right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(Area left, Area right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(Area left, Area right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(Area left, Area right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -659,7 +659,9 @@ public int CompareTo(object obj) /// public int CompareTo(Area other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -676,7 +678,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Area other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -736,7 +738,8 @@ public bool Equals(Area other, double tolerance, ComparisonType comparisonType) /// A hash code for the current Area. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs index e5b4215ceb..d4a26fcf4a 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs @@ -417,25 +417,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out AreaD /// Returns true if less or equal to. public static bool operator <=(AreaDensity left, AreaDensity right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(AreaDensity left, AreaDensity right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(AreaDensity left, AreaDensity right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(AreaDensity left, AreaDensity right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -464,7 +464,9 @@ public int CompareTo(object obj) /// public int CompareTo(AreaDensity other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -481,7 +483,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(AreaDensity other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -541,7 +543,8 @@ public bool Equals(AreaDensity other, double tolerance, ComparisonType compariso /// A hash code for the current AreaDensity. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs index 8d9872efab..161eb43840 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs @@ -492,25 +492,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out AreaM /// Returns true if less or equal to. public static bool operator <=(AreaMomentOfInertia left, AreaMomentOfInertia right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(AreaMomentOfInertia left, AreaMomentOfInertia right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(AreaMomentOfInertia left, AreaMomentOfInertia right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(AreaMomentOfInertia left, AreaMomentOfInertia right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -539,7 +539,9 @@ public int CompareTo(object obj) /// public int CompareTo(AreaMomentOfInertia other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -556,7 +558,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(AreaMomentOfInertia other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -616,7 +618,8 @@ public bool Equals(AreaMomentOfInertia other, double tolerance, ComparisonType c /// A hash code for the current AreaMomentOfInertia. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs b/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs index c7e6ad0c0e..947f31b25d 100644 --- a/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs @@ -797,25 +797,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out BitRa /// Returns true if less or equal to. public static bool operator <=(BitRate left, BitRate right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(BitRate left, BitRate right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(BitRate left, BitRate right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(BitRate left, BitRate right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -844,7 +844,9 @@ public int CompareTo(object obj) /// public int CompareTo(BitRate other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -861,7 +863,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(BitRate other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -921,7 +923,8 @@ public bool Equals(BitRate other, double tolerance, ComparisonType comparisonTyp /// A hash code for the current BitRate. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs index ec856aa869..e2be0a95e8 100644 --- a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs @@ -447,25 +447,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Brake /// Returns true if less or equal to. public static bool operator <=(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -494,7 +494,9 @@ public int CompareTo(object obj) /// public int CompareTo(BrakeSpecificFuelConsumption other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -511,7 +513,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(BrakeSpecificFuelConsumption other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -571,7 +573,8 @@ public bool Equals(BrakeSpecificFuelConsumption other, double tolerance, Compari /// A hash code for the current BrakeSpecificFuelConsumption. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Capacitance.g.cs b/UnitsNet/GeneratedCode/Quantities/Capacitance.g.cs index cfdce7831f..973301f5e0 100644 --- a/UnitsNet/GeneratedCode/Quantities/Capacitance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Capacitance.g.cs @@ -510,25 +510,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Capac /// Returns true if less or equal to. public static bool operator <=(Capacitance left, Capacitance right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(Capacitance left, Capacitance right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(Capacitance left, Capacitance right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(Capacitance left, Capacitance right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -557,7 +557,9 @@ public int CompareTo(object obj) /// public int CompareTo(Capacitance other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -574,7 +576,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Capacitance other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -634,7 +636,8 @@ public bool Equals(Capacitance other, double tolerance, ComparisonType compariso /// A hash code for the current Capacitance. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs index f0af9170e3..a298e63b08 100644 --- a/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs @@ -447,25 +447,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Coeff /// Returns true if less or equal to. public static bool operator <=(CoefficientOfThermalExpansion left, CoefficientOfThermalExpansion right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(CoefficientOfThermalExpansion left, CoefficientOfThermalExpansion right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(CoefficientOfThermalExpansion left, CoefficientOfThermalExpansion right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(CoefficientOfThermalExpansion left, CoefficientOfThermalExpansion right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -494,7 +494,9 @@ public int CompareTo(object obj) /// public int CompareTo(CoefficientOfThermalExpansion other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -511,7 +513,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(CoefficientOfThermalExpansion other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -571,7 +573,8 @@ public bool Equals(CoefficientOfThermalExpansion other, double tolerance, Compar /// A hash code for the current CoefficientOfThermalExpansion. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Density.g.cs b/UnitsNet/GeneratedCode/Quantities/Density.g.cs index da5c1bbd5b..fe6f73d66b 100644 --- a/UnitsNet/GeneratedCode/Quantities/Density.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Density.g.cs @@ -1005,25 +1005,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Densi /// Returns true if less or equal to. public static bool operator <=(Density left, Density right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(Density left, Density right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(Density left, Density right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(Density left, Density right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -1052,7 +1052,9 @@ public int CompareTo(object obj) /// public int CompareTo(Density other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -1069,7 +1071,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Density other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -1129,7 +1131,8 @@ public bool Equals(Density other, double tolerance, ComparisonType comparisonTyp /// A hash code for the current Density. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Duration.g.cs b/UnitsNet/GeneratedCode/Quantities/Duration.g.cs index 8dfbec5b24..3770127931 100644 --- a/UnitsNet/GeneratedCode/Quantities/Duration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Duration.g.cs @@ -552,25 +552,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Durat /// Returns true if less or equal to. public static bool operator <=(Duration left, Duration right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(Duration left, Duration right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(Duration left, Duration right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(Duration left, Duration right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -599,7 +599,9 @@ public int CompareTo(object obj) /// public int CompareTo(Duration other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -616,7 +618,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Duration other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -676,7 +678,8 @@ public bool Equals(Duration other, double tolerance, ComparisonType comparisonTy /// A hash code for the current Duration. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs index 04de8c4043..46fdc23a13 100644 --- a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs @@ -555,25 +555,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Dynam /// Returns true if less or equal to. public static bool operator <=(DynamicViscosity left, DynamicViscosity right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(DynamicViscosity left, DynamicViscosity right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(DynamicViscosity left, DynamicViscosity right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(DynamicViscosity left, DynamicViscosity right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -602,7 +602,9 @@ public int CompareTo(object obj) /// public int CompareTo(DynamicViscosity other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -619,7 +621,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(DynamicViscosity other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -679,7 +681,8 @@ public bool Equals(DynamicViscosity other, double tolerance, ComparisonType comp /// A hash code for the current DynamicViscosity. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs index 4d32562157..0337298038 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs @@ -462,25 +462,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Elect /// Returns true if less or equal to. public static bool operator <=(ElectricAdmittance left, ElectricAdmittance right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(ElectricAdmittance left, ElectricAdmittance right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(ElectricAdmittance left, ElectricAdmittance right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(ElectricAdmittance left, ElectricAdmittance right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -509,7 +509,9 @@ public int CompareTo(object obj) /// public int CompareTo(ElectricAdmittance other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -526,7 +528,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricAdmittance other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -586,7 +588,8 @@ public bool Equals(ElectricAdmittance other, double tolerance, ComparisonType co /// A hash code for the current ElectricAdmittance. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs index d441ab525e..750f7e49de 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs @@ -480,25 +480,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Elect /// Returns true if less or equal to. public static bool operator <=(ElectricCharge left, ElectricCharge right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(ElectricCharge left, ElectricCharge right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(ElectricCharge left, ElectricCharge right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(ElectricCharge left, ElectricCharge right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -527,7 +527,9 @@ public int CompareTo(object obj) /// public int CompareTo(ElectricCharge other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -544,7 +546,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricCharge other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -604,7 +606,8 @@ public bool Equals(ElectricCharge other, double tolerance, ComparisonType compar /// A hash code for the current ElectricCharge. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs index 7eee888c9e..2eb85ecf72 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs @@ -420,25 +420,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Elect /// Returns true if less or equal to. public static bool operator <=(ElectricChargeDensity left, ElectricChargeDensity right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(ElectricChargeDensity left, ElectricChargeDensity right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(ElectricChargeDensity left, ElectricChargeDensity right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(ElectricChargeDensity left, ElectricChargeDensity right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -467,7 +467,9 @@ public int CompareTo(object obj) /// public int CompareTo(ElectricChargeDensity other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -484,7 +486,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricChargeDensity other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -544,7 +546,8 @@ public bool Equals(ElectricChargeDensity other, double tolerance, ComparisonType /// A hash code for the current ElectricChargeDensity. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs index 9057adb96e..77cccb7b1b 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs @@ -450,25 +450,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Elect /// Returns true if less or equal to. public static bool operator <=(ElectricConductance left, ElectricConductance right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(ElectricConductance left, ElectricConductance right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(ElectricConductance left, ElectricConductance right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(ElectricConductance left, ElectricConductance right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -497,7 +497,9 @@ public int CompareTo(object obj) /// public int CompareTo(ElectricConductance other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -514,7 +516,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricConductance other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -574,7 +576,8 @@ public bool Equals(ElectricConductance other, double tolerance, ComparisonType c /// A hash code for the current ElectricConductance. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs index d55f01f9c8..e16a940e15 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs @@ -450,25 +450,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Elect /// Returns true if less or equal to. public static bool operator <=(ElectricConductivity left, ElectricConductivity right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(ElectricConductivity left, ElectricConductivity right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(ElectricConductivity left, ElectricConductivity right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(ElectricConductivity left, ElectricConductivity right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -497,7 +497,9 @@ public int CompareTo(object obj) /// public int CompareTo(ElectricConductivity other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -514,7 +516,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricConductivity other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -574,7 +576,8 @@ public bool Equals(ElectricConductivity other, double tolerance, ComparisonType /// A hash code for the current ElectricConductivity. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs index 23877d8b2b..c990dc6a82 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs @@ -522,25 +522,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Elect /// Returns true if less or equal to. public static bool operator <=(ElectricCurrent left, ElectricCurrent right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(ElectricCurrent left, ElectricCurrent right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(ElectricCurrent left, ElectricCurrent right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(ElectricCurrent left, ElectricCurrent right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -569,7 +569,9 @@ public int CompareTo(object obj) /// public int CompareTo(ElectricCurrent other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -586,7 +588,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricCurrent other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -646,7 +648,8 @@ public bool Equals(ElectricCurrent other, double tolerance, ComparisonType compa /// A hash code for the current ElectricCurrent. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs index 25fbd5bc4c..fa091b060b 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs @@ -450,25 +450,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Elect /// Returns true if less or equal to. public static bool operator <=(ElectricCurrentDensity left, ElectricCurrentDensity right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(ElectricCurrentDensity left, ElectricCurrentDensity right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(ElectricCurrentDensity left, ElectricCurrentDensity right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(ElectricCurrentDensity left, ElectricCurrentDensity right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -497,7 +497,9 @@ public int CompareTo(object obj) /// public int CompareTo(ElectricCurrentDensity other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -514,7 +516,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricCurrentDensity other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -574,7 +576,8 @@ public bool Equals(ElectricCurrentDensity other, double tolerance, ComparisonTyp /// A hash code for the current ElectricCurrentDensity. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs index e76eaeaa5c..264b9eb621 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs @@ -417,25 +417,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Elect /// Returns true if less or equal to. public static bool operator <=(ElectricCurrentGradient left, ElectricCurrentGradient right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(ElectricCurrentGradient left, ElectricCurrentGradient right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(ElectricCurrentGradient left, ElectricCurrentGradient right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(ElectricCurrentGradient left, ElectricCurrentGradient right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -464,7 +464,9 @@ public int CompareTo(object obj) /// public int CompareTo(ElectricCurrentGradient other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -481,7 +483,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricCurrentGradient other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -541,7 +543,8 @@ public bool Equals(ElectricCurrentGradient other, double tolerance, ComparisonTy /// A hash code for the current ElectricCurrentGradient. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs index 9a611d2ece..dd8e3496f0 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs @@ -420,25 +420,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Elect /// Returns true if less or equal to. public static bool operator <=(ElectricField left, ElectricField right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(ElectricField left, ElectricField right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(ElectricField left, ElectricField right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(ElectricField left, ElectricField right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -467,7 +467,9 @@ public int CompareTo(object obj) /// public int CompareTo(ElectricField other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -484,7 +486,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricField other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -544,7 +546,8 @@ public bool Equals(ElectricField other, double tolerance, ComparisonType compari /// A hash code for the current ElectricField. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs index a35692e319..ec4d9ce449 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs @@ -465,25 +465,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Elect /// Returns true if less or equal to. public static bool operator <=(ElectricInductance left, ElectricInductance right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(ElectricInductance left, ElectricInductance right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(ElectricInductance left, ElectricInductance right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(ElectricInductance left, ElectricInductance right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -512,7 +512,9 @@ public int CompareTo(object obj) /// public int CompareTo(ElectricInductance other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -529,7 +531,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricInductance other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -589,7 +591,8 @@ public bool Equals(ElectricInductance other, double tolerance, ComparisonType co /// A hash code for the current ElectricInductance. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs index 7bbac7191b..04054d4b89 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs @@ -477,25 +477,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Elect /// Returns true if less or equal to. public static bool operator <=(ElectricPotential left, ElectricPotential right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(ElectricPotential left, ElectricPotential right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(ElectricPotential left, ElectricPotential right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(ElectricPotential left, ElectricPotential right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -524,7 +524,9 @@ public int CompareTo(object obj) /// public int CompareTo(ElectricPotential other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -541,7 +543,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricPotential other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -601,7 +603,8 @@ public bool Equals(ElectricPotential other, double tolerance, ComparisonType com /// A hash code for the current ElectricPotential. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.g.cs index 652d9c8d04..00a69cb5d3 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.g.cs @@ -477,25 +477,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Elect /// Returns true if less or equal to. public static bool operator <=(ElectricPotentialAc left, ElectricPotentialAc right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(ElectricPotentialAc left, ElectricPotentialAc right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(ElectricPotentialAc left, ElectricPotentialAc right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(ElectricPotentialAc left, ElectricPotentialAc right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -524,7 +524,9 @@ public int CompareTo(object obj) /// public int CompareTo(ElectricPotentialAc other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -541,7 +543,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricPotentialAc other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -601,7 +603,8 @@ public bool Equals(ElectricPotentialAc other, double tolerance, ComparisonType c /// A hash code for the current ElectricPotentialAc. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs index dc66e7a1aa..e8646109a5 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs @@ -702,25 +702,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Elect /// Returns true if less or equal to. public static bool operator <=(ElectricPotentialChangeRate left, ElectricPotentialChangeRate right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(ElectricPotentialChangeRate left, ElectricPotentialChangeRate right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(ElectricPotentialChangeRate left, ElectricPotentialChangeRate right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(ElectricPotentialChangeRate left, ElectricPotentialChangeRate right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -749,7 +749,9 @@ public int CompareTo(object obj) /// public int CompareTo(ElectricPotentialChangeRate other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -766,7 +768,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricPotentialChangeRate other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -826,7 +828,8 @@ public bool Equals(ElectricPotentialChangeRate other, double tolerance, Comparis /// A hash code for the current ElectricPotentialChangeRate. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.g.cs index e22e2c3ad7..1374275ef0 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.g.cs @@ -477,25 +477,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Elect /// Returns true if less or equal to. public static bool operator <=(ElectricPotentialDc left, ElectricPotentialDc right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(ElectricPotentialDc left, ElectricPotentialDc right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(ElectricPotentialDc left, ElectricPotentialDc right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(ElectricPotentialDc left, ElectricPotentialDc right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -524,7 +524,9 @@ public int CompareTo(object obj) /// public int CompareTo(ElectricPotentialDc other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -541,7 +543,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricPotentialDc other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -601,7 +603,8 @@ public bool Equals(ElectricPotentialDc other, double tolerance, ComparisonType c /// A hash code for the current ElectricPotentialDc. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs index c55d1b88ef..bd8f628f6d 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs @@ -492,25 +492,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Elect /// Returns true if less or equal to. public static bool operator <=(ElectricResistance left, ElectricResistance right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(ElectricResistance left, ElectricResistance right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(ElectricResistance left, ElectricResistance right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(ElectricResistance left, ElectricResistance right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -539,7 +539,9 @@ public int CompareTo(object obj) /// public int CompareTo(ElectricResistance other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -556,7 +558,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricResistance other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -616,7 +618,8 @@ public bool Equals(ElectricResistance other, double tolerance, ComparisonType co /// A hash code for the current ElectricResistance. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs index 41d0b2791d..8c0f76ca20 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs @@ -615,25 +615,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Elect /// Returns true if less or equal to. public static bool operator <=(ElectricResistivity left, ElectricResistivity right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(ElectricResistivity left, ElectricResistivity right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(ElectricResistivity left, ElectricResistivity right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(ElectricResistivity left, ElectricResistivity right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -662,7 +662,9 @@ public int CompareTo(object obj) /// public int CompareTo(ElectricResistivity other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -679,7 +681,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricResistivity other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -739,7 +741,8 @@ public bool Equals(ElectricResistivity other, double tolerance, ComparisonType c /// A hash code for the current ElectricResistivity. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs index 98ce454741..373d8162f8 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs @@ -450,25 +450,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Elect /// Returns true if less or equal to. public static bool operator <=(ElectricSurfaceChargeDensity left, ElectricSurfaceChargeDensity right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(ElectricSurfaceChargeDensity left, ElectricSurfaceChargeDensity right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(ElectricSurfaceChargeDensity left, ElectricSurfaceChargeDensity right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(ElectricSurfaceChargeDensity left, ElectricSurfaceChargeDensity right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -497,7 +497,9 @@ public int CompareTo(object obj) /// public int CompareTo(ElectricSurfaceChargeDensity other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -514,7 +516,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricSurfaceChargeDensity other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -574,7 +576,8 @@ public bool Equals(ElectricSurfaceChargeDensity other, double tolerance, Compari /// A hash code for the current ElectricSurfaceChargeDensity. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Energy.g.cs b/UnitsNet/GeneratedCode/Quantities/Energy.g.cs index ed0c2175c6..805a10b75b 100644 --- a/UnitsNet/GeneratedCode/Quantities/Energy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Energy.g.cs @@ -942,25 +942,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Energ /// Returns true if less or equal to. public static bool operator <=(Energy left, Energy right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(Energy left, Energy right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(Energy left, Energy right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(Energy left, Energy right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -989,7 +989,9 @@ public int CompareTo(object obj) /// public int CompareTo(Energy other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -1006,7 +1008,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Energy other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -1066,7 +1068,8 @@ public bool Equals(Energy other, double tolerance, ComparisonType comparisonType /// A hash code for the current Energy. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs b/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs index 4d22327766..4ba72cd81c 100644 --- a/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs @@ -507,25 +507,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Entro /// Returns true if less or equal to. public static bool operator <=(Entropy left, Entropy right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(Entropy left, Entropy right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(Entropy left, Entropy right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(Entropy left, Entropy right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -554,7 +554,9 @@ public int CompareTo(object obj) /// public int CompareTo(Entropy other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -571,7 +573,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Entropy other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -631,7 +633,8 @@ public bool Equals(Entropy other, double tolerance, ComparisonType comparisonTyp /// A hash code for the current Entropy. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Force.g.cs b/UnitsNet/GeneratedCode/Quantities/Force.g.cs index 7fe348fb78..071b96b4a3 100644 --- a/UnitsNet/GeneratedCode/Quantities/Force.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Force.g.cs @@ -627,25 +627,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Force /// Returns true if less or equal to. public static bool operator <=(Force left, Force right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(Force left, Force right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(Force left, Force right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(Force left, Force right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -674,7 +674,9 @@ public int CompareTo(object obj) /// public int CompareTo(Force other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -691,7 +693,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Force other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -751,7 +753,8 @@ public bool Equals(Force other, double tolerance, ComparisonType comparisonType) /// A hash code for the current Force. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs index 6b0737e640..0941f50ea7 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs @@ -567,25 +567,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Force /// Returns true if less or equal to. public static bool operator <=(ForceChangeRate left, ForceChangeRate right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(ForceChangeRate left, ForceChangeRate right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(ForceChangeRate left, ForceChangeRate right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(ForceChangeRate left, ForceChangeRate right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -614,7 +614,9 @@ public int CompareTo(object obj) /// public int CompareTo(ForceChangeRate other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -631,7 +633,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ForceChangeRate other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -691,7 +693,8 @@ public bool Equals(ForceChangeRate other, double tolerance, ComparisonType compa /// A hash code for the current ForceChangeRate. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs index fd12e2a781..1a2a14cb2c 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs @@ -972,25 +972,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Force /// Returns true if less or equal to. public static bool operator <=(ForcePerLength left, ForcePerLength right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(ForcePerLength left, ForcePerLength right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(ForcePerLength left, ForcePerLength right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(ForcePerLength left, ForcePerLength right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -1019,7 +1019,9 @@ public int CompareTo(object obj) /// public int CompareTo(ForcePerLength other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -1036,7 +1038,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ForcePerLength other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -1096,7 +1098,8 @@ public bool Equals(ForcePerLength other, double tolerance, ComparisonType compar /// A hash code for the current ForcePerLength. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs b/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs index 665f183951..359f7a1ee2 100644 --- a/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs @@ -552,25 +552,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Frequ /// Returns true if less or equal to. public static bool operator <=(Frequency left, Frequency right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(Frequency left, Frequency right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(Frequency left, Frequency right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(Frequency left, Frequency right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -599,7 +599,9 @@ public int CompareTo(object obj) /// public int CompareTo(Frequency other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -616,7 +618,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Frequency other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -676,7 +678,8 @@ public bool Equals(Frequency other, double tolerance, ComparisonType comparisonT /// A hash code for the current Frequency. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs b/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs index 6fd8492a34..024c813bc7 100644 --- a/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs @@ -465,25 +465,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out FuelE /// Returns true if less or equal to. public static bool operator <=(FuelEfficiency left, FuelEfficiency right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(FuelEfficiency left, FuelEfficiency right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(FuelEfficiency left, FuelEfficiency right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(FuelEfficiency left, FuelEfficiency right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -512,7 +512,9 @@ public int CompareTo(object obj) /// public int CompareTo(FuelEfficiency other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -529,7 +531,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(FuelEfficiency other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -589,7 +591,8 @@ public bool Equals(FuelEfficiency other, double tolerance, ComparisonType compar /// A hash code for the current FuelEfficiency. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs index 06ec38a224..bc93d0068d 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs @@ -672,25 +672,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out HeatF /// Returns true if less or equal to. public static bool operator <=(HeatFlux left, HeatFlux right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(HeatFlux left, HeatFlux right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(HeatFlux left, HeatFlux right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(HeatFlux left, HeatFlux right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -719,7 +719,9 @@ public int CompareTo(object obj) /// public int CompareTo(HeatFlux other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -736,7 +738,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(HeatFlux other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -796,7 +798,8 @@ public bool Equals(HeatFlux other, double tolerance, ComparisonType comparisonTy /// A hash code for the current HeatFlux. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs index 346bd88420..e2ba9cfe96 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs @@ -447,25 +447,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out HeatT /// Returns true if less or equal to. public static bool operator <=(HeatTransferCoefficient left, HeatTransferCoefficient right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(HeatTransferCoefficient left, HeatTransferCoefficient right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(HeatTransferCoefficient left, HeatTransferCoefficient right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(HeatTransferCoefficient left, HeatTransferCoefficient right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -494,7 +494,9 @@ public int CompareTo(object obj) /// public int CompareTo(HeatTransferCoefficient other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -511,7 +513,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(HeatTransferCoefficient other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -571,7 +573,8 @@ public bool Equals(HeatTransferCoefficient other, double tolerance, ComparisonTy /// A hash code for the current HeatTransferCoefficient. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs b/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs index d18c6d8b5a..14f4231a39 100644 --- a/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs @@ -465,25 +465,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Illum /// Returns true if less or equal to. public static bool operator <=(Illuminance left, Illuminance right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(Illuminance left, Illuminance right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(Illuminance left, Illuminance right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(Illuminance left, Illuminance right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -512,7 +512,9 @@ public int CompareTo(object obj) /// public int CompareTo(Illuminance other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -529,7 +531,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Illuminance other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -589,7 +591,8 @@ public bool Equals(Illuminance other, double tolerance, ComparisonType compariso /// A hash code for the current Illuminance. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Information.g.cs b/UnitsNet/GeneratedCode/Quantities/Information.g.cs index 978d41bbbc..039bfca8dd 100644 --- a/UnitsNet/GeneratedCode/Quantities/Information.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Information.g.cs @@ -794,25 +794,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Infor /// Returns true if less or equal to. public static bool operator <=(Information left, Information right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(Information left, Information right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(Information left, Information right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(Information left, Information right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -841,7 +841,9 @@ public int CompareTo(object obj) /// public int CompareTo(Information other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -858,7 +860,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Information other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -918,7 +920,8 @@ public bool Equals(Information other, double tolerance, ComparisonType compariso /// A hash code for the current Information. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs index d6c42f7d9d..8f1ac156de 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs @@ -612,25 +612,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Irrad /// Returns true if less or equal to. public static bool operator <=(Irradiance left, Irradiance right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(Irradiance left, Irradiance right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(Irradiance left, Irradiance right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(Irradiance left, Irradiance right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -659,7 +659,9 @@ public int CompareTo(object obj) /// public int CompareTo(Irradiance other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -676,7 +678,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Irradiance other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -736,7 +738,8 @@ public bool Equals(Irradiance other, double tolerance, ComparisonType comparison /// A hash code for the current Irradiance. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs index aaa98eb2d5..7e8d41647e 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs @@ -510,25 +510,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Irrad /// Returns true if less or equal to. public static bool operator <=(Irradiation left, Irradiation right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(Irradiation left, Irradiation right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(Irradiation left, Irradiation right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(Irradiation left, Irradiation right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -557,7 +557,9 @@ public int CompareTo(object obj) /// public int CompareTo(Irradiation other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -574,7 +576,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Irradiation other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -634,7 +636,8 @@ public bool Equals(Irradiation other, double tolerance, ComparisonType compariso /// A hash code for the current Irradiation. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs index 03d75963b2..d060940bfd 100644 --- a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs @@ -525,25 +525,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Kinem /// Returns true if less or equal to. public static bool operator <=(KinematicViscosity left, KinematicViscosity right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(KinematicViscosity left, KinematicViscosity right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(KinematicViscosity left, KinematicViscosity right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(KinematicViscosity left, KinematicViscosity right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -572,7 +572,9 @@ public int CompareTo(object obj) /// public int CompareTo(KinematicViscosity other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -589,7 +591,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(KinematicViscosity other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -649,7 +651,8 @@ public bool Equals(KinematicViscosity other, double tolerance, ComparisonType co /// A hash code for the current KinematicViscosity. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/LapseRate.g.cs b/UnitsNet/GeneratedCode/Quantities/LapseRate.g.cs index 7d2099b3f5..ef346098b1 100644 --- a/UnitsNet/GeneratedCode/Quantities/LapseRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LapseRate.g.cs @@ -417,25 +417,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Lapse /// Returns true if less or equal to. public static bool operator <=(LapseRate left, LapseRate right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(LapseRate left, LapseRate right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(LapseRate left, LapseRate right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(LapseRate left, LapseRate right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -464,7 +464,9 @@ public int CompareTo(object obj) /// public int CompareTo(LapseRate other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -481,7 +483,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(LapseRate other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -541,7 +543,8 @@ public bool Equals(LapseRate other, double tolerance, ComparisonType comparisonT /// A hash code for the current LapseRate. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Length.g.cs b/UnitsNet/GeneratedCode/Quantities/Length.g.cs index c22db172d0..aad805737e 100644 --- a/UnitsNet/GeneratedCode/Quantities/Length.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Length.g.cs @@ -897,25 +897,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Lengt /// Returns true if less or equal to. public static bool operator <=(Length left, Length right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(Length left, Length right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(Length left, Length right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(Length left, Length right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -944,7 +944,9 @@ public int CompareTo(object obj) /// public int CompareTo(Length other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -961,7 +963,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Length other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -1021,7 +1023,8 @@ public bool Equals(Length other, double tolerance, ComparisonType comparisonType /// A hash code for the current Length. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Level.g.cs b/UnitsNet/GeneratedCode/Quantities/Level.g.cs index 18af1e4ca9..4c9718dcad 100644 --- a/UnitsNet/GeneratedCode/Quantities/Level.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Level.g.cs @@ -440,25 +440,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Level /// Returns true if less or equal to. public static bool operator <=(Level left, Level right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(Level left, Level right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(Level left, Level right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(Level left, Level right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -487,7 +487,9 @@ public int CompareTo(object obj) /// public int CompareTo(Level other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -504,7 +506,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Level other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -564,7 +566,8 @@ public bool Equals(Level other, double tolerance, ComparisonType comparisonType) /// A hash code for the current Level. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs index 9b16f87531..20a276807d 100644 --- a/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs @@ -615,25 +615,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Linea /// Returns true if less or equal to. public static bool operator <=(LinearDensity left, LinearDensity right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(LinearDensity left, LinearDensity right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(LinearDensity left, LinearDensity right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(LinearDensity left, LinearDensity right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -662,7 +662,9 @@ public int CompareTo(object obj) /// public int CompareTo(LinearDensity other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -679,7 +681,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(LinearDensity other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -739,7 +741,8 @@ public bool Equals(LinearDensity other, double tolerance, ComparisonType compari /// A hash code for the current LinearDensity. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs index 82a4b2473d..a3d3c86d2d 100644 --- a/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs @@ -780,25 +780,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Linea /// Returns true if less or equal to. public static bool operator <=(LinearPowerDensity left, LinearPowerDensity right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(LinearPowerDensity left, LinearPowerDensity right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(LinearPowerDensity left, LinearPowerDensity right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(LinearPowerDensity left, LinearPowerDensity right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -827,7 +827,9 @@ public int CompareTo(object obj) /// public int CompareTo(LinearPowerDensity other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -844,7 +846,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(LinearPowerDensity other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -904,7 +906,8 @@ public bool Equals(LinearPowerDensity other, double tolerance, ComparisonType co /// A hash code for the current LinearPowerDensity. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs b/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs index 893315f5ad..3993c3c34a 100644 --- a/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs @@ -615,25 +615,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Lumin /// Returns true if less or equal to. public static bool operator <=(Luminosity left, Luminosity right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(Luminosity left, Luminosity right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(Luminosity left, Luminosity right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(Luminosity left, Luminosity right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -662,7 +662,9 @@ public int CompareTo(object obj) /// public int CompareTo(Luminosity other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -679,7 +681,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Luminosity other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -739,7 +741,8 @@ public bool Equals(Luminosity other, double tolerance, ComparisonType comparison /// A hash code for the current Luminosity. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs index c0de33ed2c..e3290fa07b 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs @@ -420,25 +420,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Lumin /// Returns true if less or equal to. public static bool operator <=(LuminousFlux left, LuminousFlux right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(LuminousFlux left, LuminousFlux right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(LuminousFlux left, LuminousFlux right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(LuminousFlux left, LuminousFlux right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -467,7 +467,9 @@ public int CompareTo(object obj) /// public int CompareTo(LuminousFlux other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -484,7 +486,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(LuminousFlux other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -544,7 +546,8 @@ public bool Equals(LuminousFlux other, double tolerance, ComparisonType comparis /// A hash code for the current LuminousFlux. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs index bd25c55a5a..28ca8e8d84 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs @@ -420,25 +420,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Lumin /// Returns true if less or equal to. public static bool operator <=(LuminousIntensity left, LuminousIntensity right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(LuminousIntensity left, LuminousIntensity right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(LuminousIntensity left, LuminousIntensity right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(LuminousIntensity left, LuminousIntensity right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -467,7 +467,9 @@ public int CompareTo(object obj) /// public int CompareTo(LuminousIntensity other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -484,7 +486,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(LuminousIntensity other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -544,7 +546,8 @@ public bool Equals(LuminousIntensity other, double tolerance, ComparisonType com /// A hash code for the current LuminousIntensity. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs index 7a54cac4c8..aed0b346f0 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs @@ -465,25 +465,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Magne /// Returns true if less or equal to. public static bool operator <=(MagneticField left, MagneticField right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(MagneticField left, MagneticField right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(MagneticField left, MagneticField right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(MagneticField left, MagneticField right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -512,7 +512,9 @@ public int CompareTo(object obj) /// public int CompareTo(MagneticField other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -529,7 +531,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(MagneticField other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -589,7 +591,8 @@ public bool Equals(MagneticField other, double tolerance, ComparisonType compari /// A hash code for the current MagneticField. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs index 6a56f32260..839e7412bf 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs @@ -420,25 +420,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Magne /// Returns true if less or equal to. public static bool operator <=(MagneticFlux left, MagneticFlux right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(MagneticFlux left, MagneticFlux right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(MagneticFlux left, MagneticFlux right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(MagneticFlux left, MagneticFlux right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -467,7 +467,9 @@ public int CompareTo(object obj) /// public int CompareTo(MagneticFlux other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -484,7 +486,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(MagneticFlux other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -544,7 +546,8 @@ public bool Equals(MagneticFlux other, double tolerance, ComparisonType comparis /// A hash code for the current MagneticFlux. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs b/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs index c0aab8d7e2..091772100e 100644 --- a/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs @@ -420,25 +420,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Magne /// Returns true if less or equal to. public static bool operator <=(Magnetization left, Magnetization right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(Magnetization left, Magnetization right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(Magnetization left, Magnetization right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(Magnetization left, Magnetization right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -467,7 +467,9 @@ public int CompareTo(object obj) /// public int CompareTo(Magnetization other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -484,7 +486,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Magnetization other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -544,7 +546,8 @@ public bool Equals(Magnetization other, double tolerance, ComparisonType compari /// A hash code for the current Magnetization. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Mass.g.cs b/UnitsNet/GeneratedCode/Quantities/Mass.g.cs index 96ce9ba4e1..1feebf592a 100644 --- a/UnitsNet/GeneratedCode/Quantities/Mass.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Mass.g.cs @@ -777,25 +777,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out MassU /// Returns true if less or equal to. public static bool operator <=(Mass left, Mass right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(Mass left, Mass right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(Mass left, Mass right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(Mass left, Mass right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -824,7 +824,9 @@ public int CompareTo(object obj) /// public int CompareTo(Mass other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -841,7 +843,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Mass other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -901,7 +903,8 @@ public bool Equals(Mass other, double tolerance, ComparisonType comparisonType) /// A hash code for the current Mass. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs b/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs index ea9cb23ba5..3d4925a8e6 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs @@ -1005,25 +1005,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out MassC /// Returns true if less or equal to. public static bool operator <=(MassConcentration left, MassConcentration right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(MassConcentration left, MassConcentration right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(MassConcentration left, MassConcentration right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(MassConcentration left, MassConcentration right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -1052,7 +1052,9 @@ public int CompareTo(object obj) /// public int CompareTo(MassConcentration other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -1069,7 +1071,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(MassConcentration other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -1129,7 +1131,8 @@ public bool Equals(MassConcentration other, double tolerance, ComparisonType com /// A hash code for the current MassConcentration. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs index cc95d72957..da1899cbaf 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs @@ -897,25 +897,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out MassF /// Returns true if less or equal to. public static bool operator <=(MassFlow left, MassFlow right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(MassFlow left, MassFlow right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(MassFlow left, MassFlow right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(MassFlow left, MassFlow right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -944,7 +944,9 @@ public int CompareTo(object obj) /// public int CompareTo(MassFlow other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -961,7 +963,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(MassFlow other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -1021,7 +1023,8 @@ public bool Equals(MassFlow other, double tolerance, ComparisonType comparisonTy /// A hash code for the current MassFlow. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs index cddac285fe..e629b9f8f9 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs @@ -582,25 +582,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out MassF /// Returns true if less or equal to. public static bool operator <=(MassFlux left, MassFlux right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(MassFlux left, MassFlux right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(MassFlux left, MassFlux right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(MassFlux left, MassFlux right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -629,7 +629,9 @@ public int CompareTo(object obj) /// public int CompareTo(MassFlux other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -646,7 +648,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(MassFlux other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -706,7 +708,8 @@ public bool Equals(MassFlux other, double tolerance, ComparisonType comparisonTy /// A hash code for the current MassFlux. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs index d600750a73..63107c3979 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs @@ -765,25 +765,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out MassF /// Returns true if less or equal to. public static bool operator <=(MassFraction left, MassFraction right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(MassFraction left, MassFraction right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(MassFraction left, MassFraction right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(MassFraction left, MassFraction right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -812,7 +812,9 @@ public int CompareTo(object obj) /// public int CompareTo(MassFraction other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -829,7 +831,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(MassFraction other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -889,7 +891,8 @@ public bool Equals(MassFraction other, double tolerance, ComparisonType comparis /// A hash code for the current MassFraction. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs index 7c835aded4..698d1655d7 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs @@ -822,25 +822,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out MassM /// Returns true if less or equal to. public static bool operator <=(MassMomentOfInertia left, MassMomentOfInertia right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(MassMomentOfInertia left, MassMomentOfInertia right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(MassMomentOfInertia left, MassMomentOfInertia right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(MassMomentOfInertia left, MassMomentOfInertia right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -869,7 +869,9 @@ public int CompareTo(object obj) /// public int CompareTo(MassMomentOfInertia other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -886,7 +888,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(MassMomentOfInertia other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -946,7 +948,8 @@ public bool Equals(MassMomentOfInertia other, double tolerance, ComparisonType c /// A hash code for the current MassMomentOfInertia. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs index e77db094c4..ad3e5bdd46 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs @@ -447,25 +447,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Molar /// Returns true if less or equal to. public static bool operator <=(MolarEnergy left, MolarEnergy right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(MolarEnergy left, MolarEnergy right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(MolarEnergy left, MolarEnergy right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(MolarEnergy left, MolarEnergy right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -494,7 +494,9 @@ public int CompareTo(object obj) /// public int CompareTo(MolarEnergy other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -511,7 +513,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(MolarEnergy other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -571,7 +573,8 @@ public bool Equals(MolarEnergy other, double tolerance, ComparisonType compariso /// A hash code for the current MolarEnergy. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs index 0a174a328c..cc6bc00cb7 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs @@ -447,25 +447,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Molar /// Returns true if less or equal to. public static bool operator <=(MolarEntropy left, MolarEntropy right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(MolarEntropy left, MolarEntropy right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(MolarEntropy left, MolarEntropy right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(MolarEntropy left, MolarEntropy right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -494,7 +494,9 @@ public int CompareTo(object obj) /// public int CompareTo(MolarEntropy other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -511,7 +513,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(MolarEntropy other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -571,7 +573,8 @@ public bool Equals(MolarEntropy other, double tolerance, ComparisonType comparis /// A hash code for the current MolarEntropy. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs index afc0741065..ea436e794c 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs @@ -582,25 +582,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Molar /// Returns true if less or equal to. public static bool operator <=(MolarMass left, MolarMass right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(MolarMass left, MolarMass right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(MolarMass left, MolarMass right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(MolarMass left, MolarMass right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -629,7 +629,9 @@ public int CompareTo(object obj) /// public int CompareTo(MolarMass other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -646,7 +648,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(MolarMass other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -706,7 +708,8 @@ public bool Equals(MolarMass other, double tolerance, ComparisonType comparisonT /// A hash code for the current MolarMass. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs b/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs index 441038cbae..400489d928 100644 --- a/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs @@ -525,25 +525,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Molar /// Returns true if less or equal to. public static bool operator <=(Molarity left, Molarity right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(Molarity left, Molarity right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(Molarity left, Molarity right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(Molarity left, Molarity right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -572,7 +572,9 @@ public int CompareTo(object obj) /// public int CompareTo(Molarity other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -589,7 +591,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Molarity other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -649,7 +651,8 @@ public bool Equals(Molarity other, double tolerance, ComparisonType comparisonTy /// A hash code for the current Molarity. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs b/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs index 0c483a2e0b..ed075da905 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs @@ -420,25 +420,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Perme /// Returns true if less or equal to. public static bool operator <=(Permeability left, Permeability right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(Permeability left, Permeability right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(Permeability left, Permeability right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(Permeability left, Permeability right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -467,7 +467,9 @@ public int CompareTo(object obj) /// public int CompareTo(Permeability other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -484,7 +486,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Permeability other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -544,7 +546,8 @@ public bool Equals(Permeability other, double tolerance, ComparisonType comparis /// A hash code for the current Permeability. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs b/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs index 22611dc34f..ee1dc5567d 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs @@ -420,25 +420,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Permi /// Returns true if less or equal to. public static bool operator <=(Permittivity left, Permittivity right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(Permittivity left, Permittivity right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(Permittivity left, Permittivity right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(Permittivity left, Permittivity right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -467,7 +467,9 @@ public int CompareTo(object obj) /// public int CompareTo(Permittivity other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -484,7 +486,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Permittivity other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -544,7 +546,8 @@ public bool Equals(Permittivity other, double tolerance, ComparisonType comparis /// A hash code for the current Permittivity. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Power.g.cs b/UnitsNet/GeneratedCode/Quantities/Power.g.cs index 40e4f2b80d..0022859141 100644 --- a/UnitsNet/GeneratedCode/Quantities/Power.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Power.g.cs @@ -779,25 +779,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Power /// Returns true if less or equal to. public static bool operator <=(Power left, Power right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(Power left, Power right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(Power left, Power right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(Power left, Power right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -826,7 +826,9 @@ public int CompareTo(object obj) /// public int CompareTo(Power other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -843,7 +845,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Power other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -903,7 +905,8 @@ public bool Equals(Power other, double tolerance, ComparisonType comparisonType) /// A hash code for the current Power. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs index dc133e4b44..b00ac8eaf0 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs @@ -1062,25 +1062,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Power /// Returns true if less or equal to. public static bool operator <=(PowerDensity left, PowerDensity right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(PowerDensity left, PowerDensity right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(PowerDensity left, PowerDensity right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(PowerDensity left, PowerDensity right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -1109,7 +1109,9 @@ public int CompareTo(object obj) /// public int CompareTo(PowerDensity other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -1126,7 +1128,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(PowerDensity other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -1186,7 +1188,8 @@ public bool Equals(PowerDensity other, double tolerance, ComparisonType comparis /// A hash code for the current PowerDensity. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs index 9406f5e527..40844872c2 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs @@ -440,25 +440,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Power /// Returns true if less or equal to. public static bool operator <=(PowerRatio left, PowerRatio right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(PowerRatio left, PowerRatio right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(PowerRatio left, PowerRatio right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(PowerRatio left, PowerRatio right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -487,7 +487,9 @@ public int CompareTo(object obj) /// public int CompareTo(PowerRatio other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -504,7 +506,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(PowerRatio other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -564,7 +566,8 @@ public bool Equals(PowerRatio other, double tolerance, ComparisonType comparison /// A hash code for the current PowerRatio. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs b/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs index 02efb5dda6..4ca06996f5 100644 --- a/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs @@ -1032,25 +1032,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Press /// Returns true if less or equal to. public static bool operator <=(Pressure left, Pressure right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(Pressure left, Pressure right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(Pressure left, Pressure right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(Pressure left, Pressure right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -1079,7 +1079,9 @@ public int CompareTo(object obj) /// public int CompareTo(Pressure other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -1096,7 +1098,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Pressure other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -1156,7 +1158,8 @@ public bool Equals(Pressure other, double tolerance, ComparisonType comparisonTy /// A hash code for the current Pressure. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs index 47a2a95a60..808ebd8dab 100644 --- a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs @@ -507,25 +507,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Press /// Returns true if less or equal to. public static bool operator <=(PressureChangeRate left, PressureChangeRate right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(PressureChangeRate left, PressureChangeRate right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(PressureChangeRate left, PressureChangeRate right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(PressureChangeRate left, PressureChangeRate right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -554,7 +554,9 @@ public int CompareTo(object obj) /// public int CompareTo(PressureChangeRate other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -571,7 +573,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(PressureChangeRate other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -631,7 +633,8 @@ public bool Equals(PressureChangeRate other, double tolerance, ComparisonType co /// A hash code for the current PressureChangeRate. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs b/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs index 4a78e8b313..0ca70ee707 100644 --- a/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs @@ -492,25 +492,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Ratio /// Returns true if less or equal to. public static bool operator <=(Ratio left, Ratio right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(Ratio left, Ratio right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(Ratio left, Ratio right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(Ratio left, Ratio right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -539,7 +539,9 @@ public int CompareTo(object obj) /// public int CompareTo(Ratio other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -556,7 +558,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Ratio other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -616,7 +618,8 @@ public bool Equals(Ratio other, double tolerance, ComparisonType comparisonType) /// A hash code for the current Ratio. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs index 71f8f7652c..c3473bf6aa 100644 --- a/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs @@ -432,25 +432,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Ratio /// Returns true if less or equal to. public static bool operator <=(RatioChangeRate left, RatioChangeRate right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(RatioChangeRate left, RatioChangeRate right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(RatioChangeRate left, RatioChangeRate right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(RatioChangeRate left, RatioChangeRate right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -479,7 +479,9 @@ public int CompareTo(object obj) /// public int CompareTo(RatioChangeRate other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -496,7 +498,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(RatioChangeRate other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -556,7 +558,8 @@ public bool Equals(RatioChangeRate other, double tolerance, ComparisonType compa /// A hash code for the current RatioChangeRate. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.g.cs index f1a4e78f17..c1dd55d0a0 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.g.cs @@ -447,25 +447,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out React /// Returns true if less or equal to. public static bool operator <=(ReactiveEnergy left, ReactiveEnergy right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(ReactiveEnergy left, ReactiveEnergy right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(ReactiveEnergy left, ReactiveEnergy right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(ReactiveEnergy left, ReactiveEnergy right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -494,7 +494,9 @@ public int CompareTo(object obj) /// public int CompareTo(ReactiveEnergy other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -511,7 +513,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ReactiveEnergy other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -571,7 +573,8 @@ public bool Equals(ReactiveEnergy other, double tolerance, ComparisonType compar /// A hash code for the current ReactiveEnergy. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ReactivePower.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactivePower.g.cs index 54cb0b2510..27ed42a1e9 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactivePower.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactivePower.g.cs @@ -462,25 +462,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out React /// Returns true if less or equal to. public static bool operator <=(ReactivePower left, ReactivePower right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(ReactivePower left, ReactivePower right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(ReactivePower left, ReactivePower right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(ReactivePower left, ReactivePower right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -509,7 +509,9 @@ public int CompareTo(object obj) /// public int CompareTo(ReactivePower other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -526,7 +528,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ReactivePower other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -586,7 +588,8 @@ public bool Equals(ReactivePower other, double tolerance, ComparisonType compari /// A hash code for the current ReactivePower. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs index a509b07238..e0c55cdcb7 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs @@ -462,25 +462,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Rotat /// Returns true if less or equal to. public static bool operator <=(RotationalAcceleration left, RotationalAcceleration right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(RotationalAcceleration left, RotationalAcceleration right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(RotationalAcceleration left, RotationalAcceleration right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(RotationalAcceleration left, RotationalAcceleration right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -509,7 +509,9 @@ public int CompareTo(object obj) /// public int CompareTo(RotationalAcceleration other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -526,7 +528,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(RotationalAcceleration other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -586,7 +588,8 @@ public bool Equals(RotationalAcceleration other, double tolerance, ComparisonTyp /// A hash code for the current RotationalAcceleration. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs index 5b9a8a95c1..8146e96589 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs @@ -597,25 +597,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Rotat /// Returns true if less or equal to. public static bool operator <=(RotationalSpeed left, RotationalSpeed right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(RotationalSpeed left, RotationalSpeed right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(RotationalSpeed left, RotationalSpeed right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(RotationalSpeed left, RotationalSpeed right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -644,7 +644,9 @@ public int CompareTo(object obj) /// public int CompareTo(RotationalSpeed other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -661,7 +663,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(RotationalSpeed other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -721,7 +723,8 @@ public bool Equals(RotationalSpeed other, double tolerance, ComparisonType compa /// A hash code for the current RotationalSpeed. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs index 390a8b8cab..a98191e56f 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs @@ -897,25 +897,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Rotat /// Returns true if less or equal to. public static bool operator <=(RotationalStiffness left, RotationalStiffness right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(RotationalStiffness left, RotationalStiffness right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(RotationalStiffness left, RotationalStiffness right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(RotationalStiffness left, RotationalStiffness right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -944,7 +944,9 @@ public int CompareTo(object obj) /// public int CompareTo(RotationalStiffness other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -961,7 +963,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(RotationalStiffness other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -1021,7 +1023,8 @@ public bool Equals(RotationalStiffness other, double tolerance, ComparisonType c /// A hash code for the current RotationalStiffness. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs index 01d17a8096..cd7e4a6555 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs @@ -477,25 +477,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Rotat /// Returns true if less or equal to. public static bool operator <=(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -524,7 +524,9 @@ public int CompareTo(object obj) /// public int CompareTo(RotationalStiffnessPerLength other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -541,7 +543,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(RotationalStiffnessPerLength other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -601,7 +603,8 @@ public bool Equals(RotationalStiffnessPerLength other, double tolerance, Compari /// A hash code for the current RotationalStiffnessPerLength. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs b/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs index 8ab2aad5ba..022315ec1b 100644 --- a/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs @@ -420,25 +420,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Solid /// Returns true if less or equal to. public static bool operator <=(SolidAngle left, SolidAngle right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(SolidAngle left, SolidAngle right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(SolidAngle left, SolidAngle right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(SolidAngle left, SolidAngle right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -467,7 +467,9 @@ public int CompareTo(object obj) /// public int CompareTo(SolidAngle other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -484,7 +486,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(SolidAngle other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -544,7 +546,8 @@ public bool Equals(SolidAngle other, double tolerance, ComparisonType comparison /// A hash code for the current SolidAngle. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs index 621840c989..a94926bb7e 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs @@ -780,25 +780,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Speci /// Returns true if less or equal to. public static bool operator <=(SpecificEnergy left, SpecificEnergy right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(SpecificEnergy left, SpecificEnergy right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(SpecificEnergy left, SpecificEnergy right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(SpecificEnergy left, SpecificEnergy right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -827,7 +827,9 @@ public int CompareTo(object obj) /// public int CompareTo(SpecificEnergy other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -844,7 +846,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(SpecificEnergy other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -904,7 +906,8 @@ public bool Equals(SpecificEnergy other, double tolerance, ComparisonType compar /// A hash code for the current SpecificEnergy. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs index dfd71b9c55..76d7ef6fa7 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs @@ -537,25 +537,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Speci /// Returns true if less or equal to. public static bool operator <=(SpecificEntropy left, SpecificEntropy right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(SpecificEntropy left, SpecificEntropy right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(SpecificEntropy left, SpecificEntropy right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(SpecificEntropy left, SpecificEntropy right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -584,7 +584,9 @@ public int CompareTo(object obj) /// public int CompareTo(SpecificEntropy other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -601,7 +603,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(SpecificEntropy other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -661,7 +663,8 @@ public bool Equals(SpecificEntropy other, double tolerance, ComparisonType compa /// A hash code for the current SpecificEntropy. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs index ea543e12f3..5f628e9789 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs @@ -447,25 +447,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Speci /// Returns true if less or equal to. public static bool operator <=(SpecificVolume left, SpecificVolume right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(SpecificVolume left, SpecificVolume right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(SpecificVolume left, SpecificVolume right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(SpecificVolume left, SpecificVolume right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -494,7 +494,9 @@ public int CompareTo(object obj) /// public int CompareTo(SpecificVolume other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -511,7 +513,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(SpecificVolume other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -571,7 +573,8 @@ public bool Equals(SpecificVolume other, double tolerance, ComparisonType compar /// A hash code for the current SpecificVolume. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs index b54221b038..b16b20b835 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs @@ -660,25 +660,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Speci /// Returns true if less or equal to. public static bool operator <=(SpecificWeight left, SpecificWeight right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(SpecificWeight left, SpecificWeight right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(SpecificWeight left, SpecificWeight right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(SpecificWeight left, SpecificWeight right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -707,7 +707,9 @@ public int CompareTo(object obj) /// public int CompareTo(SpecificWeight other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -724,7 +726,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(SpecificWeight other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -784,7 +786,8 @@ public bool Equals(SpecificWeight other, double tolerance, ComparisonType compar /// A hash code for the current SpecificWeight. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Speed.g.cs b/UnitsNet/GeneratedCode/Quantities/Speed.g.cs index 12460402a7..c737f029fc 100644 --- a/UnitsNet/GeneratedCode/Quantities/Speed.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Speed.g.cs @@ -882,25 +882,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Speed /// Returns true if less or equal to. public static bool operator <=(Speed left, Speed right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(Speed left, Speed right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(Speed left, Speed right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(Speed left, Speed right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -929,7 +929,9 @@ public int CompareTo(object obj) /// public int CompareTo(Speed other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -946,7 +948,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Speed other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -1006,7 +1008,8 @@ public bool Equals(Speed other, double tolerance, ComparisonType comparisonType) /// A hash code for the current Speed. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs b/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs index 457489ea95..96be9d8dc7 100644 --- a/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs @@ -506,25 +506,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Tempe /// Returns true if less or equal to. public static bool operator <=(Temperature left, Temperature right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(Temperature left, Temperature right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(Temperature left, Temperature right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(Temperature left, Temperature right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -553,7 +553,9 @@ public int CompareTo(object obj) /// public int CompareTo(Temperature other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -570,7 +572,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Temperature other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -630,7 +632,8 @@ public bool Equals(Temperature other, double tolerance, ComparisonType compariso /// A hash code for the current Temperature. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs index d39c7fe412..43fe70651b 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs @@ -552,25 +552,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Tempe /// Returns true if less or equal to. public static bool operator <=(TemperatureChangeRate left, TemperatureChangeRate right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(TemperatureChangeRate left, TemperatureChangeRate right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(TemperatureChangeRate left, TemperatureChangeRate right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(TemperatureChangeRate left, TemperatureChangeRate right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -599,7 +599,9 @@ public int CompareTo(object obj) /// public int CompareTo(TemperatureChangeRate other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -616,7 +618,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(TemperatureChangeRate other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -676,7 +678,8 @@ public bool Equals(TemperatureChangeRate other, double tolerance, ComparisonType /// A hash code for the current TemperatureChangeRate. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs index c848c80097..d3b31a502f 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs @@ -537,25 +537,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Tempe /// Returns true if less or equal to. public static bool operator <=(TemperatureDelta left, TemperatureDelta right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(TemperatureDelta left, TemperatureDelta right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(TemperatureDelta left, TemperatureDelta right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(TemperatureDelta left, TemperatureDelta right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -584,7 +584,9 @@ public int CompareTo(object obj) /// public int CompareTo(TemperatureDelta other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -601,7 +603,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(TemperatureDelta other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -661,7 +663,8 @@ public bool Equals(TemperatureDelta other, double tolerance, ComparisonType comp /// A hash code for the current TemperatureDelta. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs index 048426f900..fb674a19fe 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs @@ -435,25 +435,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Therm /// Returns true if less or equal to. public static bool operator <=(ThermalConductivity left, ThermalConductivity right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(ThermalConductivity left, ThermalConductivity right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(ThermalConductivity left, ThermalConductivity right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(ThermalConductivity left, ThermalConductivity right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -482,7 +482,9 @@ public int CompareTo(object obj) /// public int CompareTo(ThermalConductivity other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -499,7 +501,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ThermalConductivity other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -559,7 +561,8 @@ public bool Equals(ThermalConductivity other, double tolerance, ComparisonType c /// A hash code for the current ThermalConductivity. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs index 4f415cffc9..09b7c3fb70 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs @@ -477,25 +477,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Therm /// Returns true if less or equal to. public static bool operator <=(ThermalResistance left, ThermalResistance right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(ThermalResistance left, ThermalResistance right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(ThermalResistance left, ThermalResistance right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(ThermalResistance left, ThermalResistance right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -524,7 +524,9 @@ public int CompareTo(object obj) /// public int CompareTo(ThermalResistance other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -541,7 +543,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ThermalResistance other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -601,7 +603,8 @@ public bool Equals(ThermalResistance other, double tolerance, ComparisonType com /// A hash code for the current ThermalResistance. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Torque.g.cs b/UnitsNet/GeneratedCode/Quantities/Torque.g.cs index c34bd7af3b..e9facff0d9 100644 --- a/UnitsNet/GeneratedCode/Quantities/Torque.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Torque.g.cs @@ -717,25 +717,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Torqu /// Returns true if less or equal to. public static bool operator <=(Torque left, Torque right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(Torque left, Torque right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(Torque left, Torque right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(Torque left, Torque right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -764,7 +764,9 @@ public int CompareTo(object obj) /// public int CompareTo(Torque other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -781,7 +783,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Torque other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -841,7 +843,8 @@ public bool Equals(Torque other, double tolerance, ComparisonType comparisonType /// A hash code for the current Torque. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/TorquePerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/TorquePerLength.g.cs index a3cc53ac38..89d71ca50e 100644 --- a/UnitsNet/GeneratedCode/Quantities/TorquePerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TorquePerLength.g.cs @@ -717,25 +717,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Torqu /// Returns true if less or equal to. public static bool operator <=(TorquePerLength left, TorquePerLength right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(TorquePerLength left, TorquePerLength right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(TorquePerLength left, TorquePerLength right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(TorquePerLength left, TorquePerLength right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -764,7 +764,9 @@ public int CompareTo(object obj) /// public int CompareTo(TorquePerLength other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -781,7 +783,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(TorquePerLength other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -841,7 +843,8 @@ public bool Equals(TorquePerLength other, double tolerance, ComparisonType compa /// A hash code for the current TorquePerLength. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs b/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs index 1389e35218..76978c7472 100644 --- a/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs @@ -417,25 +417,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Vitam /// Returns true if less or equal to. public static bool operator <=(VitaminA left, VitaminA right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(VitaminA left, VitaminA right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(VitaminA left, VitaminA right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(VitaminA left, VitaminA right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -464,7 +464,9 @@ public int CompareTo(object obj) /// public int CompareTo(VitaminA other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -481,7 +483,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(VitaminA other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -541,7 +543,8 @@ public bool Equals(VitaminA other, double tolerance, ComparisonType comparisonTy /// A hash code for the current VitaminA. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Volume.g.cs b/UnitsNet/GeneratedCode/Quantities/Volume.g.cs index 4f6fa268e8..d95e508b20 100644 --- a/UnitsNet/GeneratedCode/Quantities/Volume.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Volume.g.cs @@ -1167,25 +1167,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Volum /// Returns true if less or equal to. public static bool operator <=(Volume left, Volume right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(Volume left, Volume right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(Volume left, Volume right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(Volume left, Volume right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -1214,7 +1214,9 @@ public int CompareTo(object obj) /// public int CompareTo(Volume other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -1231,7 +1233,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Volume other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -1291,7 +1293,8 @@ public bool Equals(Volume other, double tolerance, ComparisonType comparisonType /// A hash code for the current Volume. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs index 0a8e0c65ae..a1a0faed11 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs @@ -705,25 +705,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Volum /// Returns true if less or equal to. public static bool operator <=(VolumeConcentration left, VolumeConcentration right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(VolumeConcentration left, VolumeConcentration right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(VolumeConcentration left, VolumeConcentration right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(VolumeConcentration left, VolumeConcentration right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -752,7 +752,9 @@ public int CompareTo(object obj) /// public int CompareTo(VolumeConcentration other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -769,7 +771,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(VolumeConcentration other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -829,7 +831,8 @@ public bool Equals(VolumeConcentration other, double tolerance, ComparisonType c /// A hash code for the current VolumeConcentration. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs index 6e9d42012a..2aa6ff9c41 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs @@ -1137,25 +1137,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Volum /// Returns true if less or equal to. public static bool operator <=(VolumeFlow left, VolumeFlow right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(VolumeFlow left, VolumeFlow right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(VolumeFlow left, VolumeFlow right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(VolumeFlow left, VolumeFlow right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -1184,7 +1184,9 @@ public int CompareTo(object obj) /// public int CompareTo(VolumeFlow other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -1201,7 +1203,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(VolumeFlow other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -1261,7 +1263,8 @@ public bool Equals(VolumeFlow other, double tolerance, ComparisonType comparison /// A hash code for the current VolumeFlow. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs index 6efb549f0a..678edd0500 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs @@ -507,25 +507,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Volum /// Returns true if less or equal to. public static bool operator <=(VolumePerLength left, VolumePerLength right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(VolumePerLength left, VolumePerLength right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(VolumePerLength left, VolumePerLength right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(VolumePerLength left, VolumePerLength right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -554,7 +554,9 @@ public int CompareTo(object obj) /// public int CompareTo(VolumePerLength other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -571,7 +573,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(VolumePerLength other) { - return _value.Equals(other.GetValueAs(this.Unit)); + return CompareTo(other) == 0; } /// @@ -631,7 +633,8 @@ public bool Equals(VolumePerLength other, double tolerance, ComparisonType compa /// A hash code for the current VolumePerLength. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); + return new { QuantityType, roundedBaseValue }.GetHashCode(); } #endregion From 28d55bcdc7ffe0e30e94c52247804a8809825f29 Mon Sep 17 00:00:00 2001 From: lipchev Date: Mon, 21 Sep 2020 22:45:41 +0300 Subject: [PATCH 2/5] fixing typos in QuantityComparisonTests fixing GetHashCode typos --- UnitsNet.Tests/QuantityComparisonTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/UnitsNet.Tests/QuantityComparisonTests.cs b/UnitsNet.Tests/QuantityComparisonTests.cs index 4a9f4befbe..fee2972965 100644 --- a/UnitsNet.Tests/QuantityComparisonTests.cs +++ b/UnitsNet.Tests/QuantityComparisonTests.cs @@ -48,7 +48,7 @@ public void Equals_WithVeryCloseQuantityInSameUnit_ReturnsFalse() } [Fact] - public void GetHasCode_WithSameQuantityInAnotherUnit_ReturnsSameValue() + public void GetHashCode_WithSameQuantityInAnotherUnit_ReturnsSameValue() { var firstMass = Mass.FromGrams(0.001); var secondMass = firstMass.ToUnit(MassUnit.Microgram); @@ -57,7 +57,7 @@ public void GetHasCode_WithSameQuantityInAnotherUnit_ReturnsSameValue() } [Fact] - public void GetHasCode_WithVeryCloseQuantities_ReturnsSameValue() + public void GetHashCode_WithVeryCloseQuantities_ReturnsSameValue() { var firstMass = Mass.FromGrams(0); var secondMass = Mass.FromGrams(double.Epsilon); From 7b15a7f2a916279c2ebf6bb5ada79e087ad57652 Mon Sep 17 00:00:00 2001 From: lipchev Date: Sun, 7 Mar 2021 08:10:07 +0200 Subject: [PATCH 3/5] - reverted the Equals impelmentation: as before using the Value == other.As(Unit) - changed the GetHashCode generation scheme: depending on the QuantityType alone (the unit & value are ignored) - updated the two relevant tests (that were previously passing using mixed units) --- .../Generators/UnitsNetGen/QuantityGenerator.cs | 5 ++--- .../UnitsNetGen/UnitTestBaseClassGenerator.cs | 3 +-- UnitsNet.Tests/QuantityComparisonTests.cs | 16 ++++++++++------ 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs b/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs index 963e9fb5fe..bf785c8010 100644 --- a/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs +++ b/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs @@ -734,7 +734,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals({_quantity.Name} other) {{ - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); }} /// @@ -794,8 +794,7 @@ public bool Equals({_quantity.Name} other, double tolerance, ComparisonType comp /// A hash code for the current {_quantity.Name}. public override int GetHashCode() {{ - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new {{ QuantityType, roundedBaseValue }}.GetHashCode(); + return QuantityType.GetHashCode(); }} #endregion diff --git a/CodeGen/Generators/UnitsNetGen/UnitTestBaseClassGenerator.cs b/CodeGen/Generators/UnitsNetGen/UnitTestBaseClassGenerator.cs index 8490838cb6..be35ea5bde 100644 --- a/CodeGen/Generators/UnitsNetGen/UnitTestBaseClassGenerator.cs +++ b/CodeGen/Generators/UnitsNetGen/UnitTestBaseClassGenerator.cs @@ -643,8 +643,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() {{ var quantity = {_quantity.Name}.From{_baseUnit.PluralName}(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {{{_quantity.Name}.QuantityType, roundedBaseValue}}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal({_quantity.Name}.QuantityType.GetHashCode(), quantity.GetHashCode()); }} "); diff --git a/UnitsNet.Tests/QuantityComparisonTests.cs b/UnitsNet.Tests/QuantityComparisonTests.cs index fee2972965..7b77acd201 100644 --- a/UnitsNet.Tests/QuantityComparisonTests.cs +++ b/UnitsNet.Tests/QuantityComparisonTests.cs @@ -28,12 +28,12 @@ public void CompareTo_WithVeryCloseQuantity_ReturnsNonZero() } [Fact] - public void Equals_WithSameQuantityInAnotherUnit_ReturnsTrue() + public void Equals_WithSameQuantityInAnotherUnit_IsNotReflexive() { var firstMass = Mass.FromGrams(0.001); var secondMass = firstMass.ToUnit(MassUnit.Microgram); - Assert.Equal(firstMass, secondMass); + Assert.NotEqual(firstMass, secondMass); Assert.Equal(secondMass, firstMass); } @@ -66,15 +66,19 @@ public void GetHashCode_WithVeryCloseQuantities_ReturnsSameValue() } [Fact] - public void Contains_CollectionWithMixedUnits_ReturnsTrueIfValuesAreStrictlyEqual() + public void Contains_CollectionWithMixedUnits_DependsOnTheOrderOfInsertion() { var firstMass = Mass.FromGrams(0.001); var secondMass = firstMass.ToUnit(MassUnit.Microgram); - var collection = new HashSet {firstMass}; + var collectionWithFirst = new HashSet {firstMass}; + var collectionWithSecond = new HashSet {secondMass}; - Assert.Contains(firstMass, collection); - Assert.Contains(secondMass, collection); + Assert.Contains(firstMass, collectionWithFirst); + Assert.DoesNotContain(secondMass, collectionWithFirst); + + Assert.Contains(firstMass, collectionWithSecond); + Assert.Contains(secondMass, collectionWithSecond); } [Fact] From a9dd98631a8cdacce5355a9ca5224ee8890763fd Mon Sep 17 00:00:00 2001 From: lipchev Date: Sun, 7 Mar 2021 08:11:15 +0200 Subject: [PATCH 4/5] ..and the generated code --- .../GeneratedCode/TestsBase/AccelerationTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/AmountOfSubstanceTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/AmplitudeRatioTestsBase.g.cs | 3 +-- UnitsNet.Tests/GeneratedCode/TestsBase/AngleTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/ApparentEnergyTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/ApparentPowerTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/AreaDensityTestsBase.g.cs | 3 +-- .../TestsBase/AreaMomentOfInertiaTestsBase.g.cs | 3 +-- UnitsNet.Tests/GeneratedCode/TestsBase/AreaTestsBase.g.cs | 3 +-- UnitsNet.Tests/GeneratedCode/TestsBase/BitRateTestsBase.g.cs | 3 +-- .../TestsBase/BrakeSpecificFuelConsumptionTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/CapacitanceTestsBase.g.cs | 3 +-- .../TestsBase/CoefficientOfThermalExpansionTestsBase.g.cs | 3 +-- UnitsNet.Tests/GeneratedCode/TestsBase/DensityTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/DurationTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/DynamicViscosityTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/ElectricAdmittanceTestsBase.g.cs | 3 +-- .../TestsBase/ElectricChargeDensityTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/ElectricChargeTestsBase.g.cs | 3 +-- .../TestsBase/ElectricConductanceTestsBase.g.cs | 3 +-- .../TestsBase/ElectricConductivityTestsBase.g.cs | 3 +-- .../TestsBase/ElectricCurrentDensityTestsBase.g.cs | 3 +-- .../TestsBase/ElectricCurrentGradientTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/ElectricCurrentTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/ElectricFieldTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/ElectricInductanceTestsBase.g.cs | 3 +-- .../TestsBase/ElectricPotentialAcTestsBase.g.cs | 3 +-- .../TestsBase/ElectricPotentialChangeRateTestsBase.g.cs | 3 +-- .../TestsBase/ElectricPotentialDcTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/ElectricPotentialTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/ElectricResistanceTestsBase.g.cs | 3 +-- .../TestsBase/ElectricResistivityTestsBase.g.cs | 3 +-- .../TestsBase/ElectricSurfaceChargeDensityTestsBase.g.cs | 3 +-- UnitsNet.Tests/GeneratedCode/TestsBase/EnergyTestsBase.g.cs | 3 +-- UnitsNet.Tests/GeneratedCode/TestsBase/EntropyTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/ForceChangeRateTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/ForcePerLengthTestsBase.g.cs | 3 +-- UnitsNet.Tests/GeneratedCode/TestsBase/ForceTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/FrequencyTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/FuelEfficiencyTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/HeatFluxTestsBase.g.cs | 3 +-- .../TestsBase/HeatTransferCoefficientTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/IlluminanceTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/InformationTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/IrradianceTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/IrradiationTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/KinematicViscosityTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/LapseRateTestsBase.g.cs | 3 +-- UnitsNet.Tests/GeneratedCode/TestsBase/LengthTestsBase.g.cs | 3 +-- UnitsNet.Tests/GeneratedCode/TestsBase/LevelTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/LinearDensityTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/LinearPowerDensityTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/LuminosityTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/LuminousFluxTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/LuminousIntensityTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/MagneticFieldTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/MagneticFluxTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/MagnetizationTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/MassConcentrationTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/MassFlowTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/MassFluxTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/MassFractionTestsBase.g.cs | 3 +-- .../TestsBase/MassMomentOfInertiaTestsBase.g.cs | 3 +-- UnitsNet.Tests/GeneratedCode/TestsBase/MassTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/MolarEnergyTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/MolarEntropyTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/MolarMassTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/MolarityTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/PermeabilityTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/PermittivityTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/PowerDensityTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/PowerRatioTestsBase.g.cs | 3 +-- UnitsNet.Tests/GeneratedCode/TestsBase/PowerTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/PressureChangeRateTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/PressureTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/RatioChangeRateTestsBase.g.cs | 3 +-- UnitsNet.Tests/GeneratedCode/TestsBase/RatioTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/ReactiveEnergyTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/ReactivePowerTestsBase.g.cs | 3 +-- .../TestsBase/RotationalAccelerationTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/RotationalSpeedTestsBase.g.cs | 3 +-- .../TestsBase/RotationalStiffnessPerLengthTestsBase.g.cs | 3 +-- .../TestsBase/RotationalStiffnessTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/SolidAngleTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/SpecificEnergyTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/SpecificEntropyTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/SpecificVolumeTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/SpecificWeightTestsBase.g.cs | 3 +-- UnitsNet.Tests/GeneratedCode/TestsBase/SpeedTestsBase.g.cs | 3 +-- .../TestsBase/TemperatureChangeRateTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/TemperatureDeltaTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/TemperatureTestsBase.g.cs | 3 +-- .../TestsBase/ThermalConductivityTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/ThermalResistanceTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/TorquePerLengthTestsBase.g.cs | 3 +-- UnitsNet.Tests/GeneratedCode/TestsBase/TorqueTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/VitaminATestsBase.g.cs | 3 +-- .../TestsBase/VolumeConcentrationTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/VolumeFlowTestsBase.g.cs | 3 +-- .../GeneratedCode/TestsBase/VolumePerLengthTestsBase.g.cs | 3 +-- UnitsNet.Tests/GeneratedCode/TestsBase/VolumeTestsBase.g.cs | 3 +-- UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/Angle.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/Area.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/BitRate.g.cs | 5 ++--- .../Quantities/BrakeSpecificFuelConsumption.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/Capacitance.g.cs | 5 ++--- .../Quantities/CoefficientOfThermalExpansion.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/Density.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/Duration.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs | 5 ++--- .../GeneratedCode/Quantities/ElectricCurrentDensity.g.cs | 5 ++--- .../GeneratedCode/Quantities/ElectricCurrentGradient.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.g.cs | 5 ++--- .../Quantities/ElectricPotentialChangeRate.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs | 5 ++--- .../Quantities/ElectricSurfaceChargeDensity.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/Energy.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/Entropy.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/Force.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/Frequency.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs | 5 ++--- .../GeneratedCode/Quantities/HeatTransferCoefficient.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/Information.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/LapseRate.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/Length.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/Level.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/Mass.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/Molarity.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/Permeability.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/Power.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/Pressure.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/Ratio.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/ReactivePower.g.cs | 5 ++--- .../GeneratedCode/Quantities/RotationalAcceleration.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs | 5 ++--- .../Quantities/RotationalStiffnessPerLength.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/Speed.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/Temperature.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/Torque.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/TorquePerLength.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/Volume.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs | 5 ++--- UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs | 5 ++--- 202 files changed, 303 insertions(+), 505 deletions(-) diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AccelerationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AccelerationTestsBase.g.cs index 7aa47ff01e..c7c1d70549 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/AccelerationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AccelerationTestsBase.g.cs @@ -713,8 +713,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Acceleration.FromMetersPerSecondSquared(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {Acceleration.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(Acceleration.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AmountOfSubstanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AmountOfSubstanceTestsBase.g.cs index f443812305..f19877c224 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/AmountOfSubstanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AmountOfSubstanceTestsBase.g.cs @@ -728,8 +728,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = AmountOfSubstance.FromMoles(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {AmountOfSubstance.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(AmountOfSubstance.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AmplitudeRatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AmplitudeRatioTestsBase.g.cs index 6d527a0bcd..c0e176f269 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/AmplitudeRatioTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AmplitudeRatioTestsBase.g.cs @@ -567,8 +567,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = AmplitudeRatio.FromDecibelVolts(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {AmplitudeRatio.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(AmplitudeRatio.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AngleTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AngleTestsBase.g.cs index e196378db4..407f81a2a9 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/AngleTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AngleTestsBase.g.cs @@ -713,8 +713,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Angle.FromDegrees(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {Angle.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(Angle.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ApparentEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ApparentEnergyTestsBase.g.cs index 131c8b84ad..9b7e280415 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ApparentEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ApparentEnergyTestsBase.g.cs @@ -548,8 +548,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ApparentEnergy.FromVoltampereHours(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {ApparentEnergy.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(ApparentEnergy.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ApparentPowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ApparentPowerTestsBase.g.cs index 76f787f3d5..e892729e45 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ApparentPowerTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ApparentPowerTestsBase.g.cs @@ -563,8 +563,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ApparentPower.FromVoltamperes(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {ApparentPower.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(ApparentPower.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AreaDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AreaDensityTestsBase.g.cs index 5b232dbb60..9ca0df9467 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/AreaDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AreaDensityTestsBase.g.cs @@ -518,8 +518,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = AreaDensity.FromKilogramsPerSquareMeter(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {AreaDensity.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(AreaDensity.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AreaMomentOfInertiaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AreaMomentOfInertiaTestsBase.g.cs index f472edb6d0..4b3a5dbc56 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/AreaMomentOfInertiaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AreaMomentOfInertiaTestsBase.g.cs @@ -593,8 +593,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = AreaMomentOfInertia.FromMetersToTheFourth(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {AreaMomentOfInertia.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(AreaMomentOfInertia.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AreaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AreaTestsBase.g.cs index 6cfbfe9e72..0f9478d1da 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/AreaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AreaTestsBase.g.cs @@ -713,8 +713,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Area.FromSquareMeters(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {Area.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(Area.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/BitRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/BitRateTestsBase.g.cs index 820d1b82dc..0b671c2a16 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/BitRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/BitRateTestsBase.g.cs @@ -861,8 +861,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = BitRate.FromBitsPerSecond(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {BitRate.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(BitRate.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/BrakeSpecificFuelConsumptionTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/BrakeSpecificFuelConsumptionTestsBase.g.cs index 42874fe2d0..6541b398e9 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/BrakeSpecificFuelConsumptionTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/BrakeSpecificFuelConsumptionTestsBase.g.cs @@ -548,8 +548,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {BrakeSpecificFuelConsumption.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(BrakeSpecificFuelConsumption.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/CapacitanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/CapacitanceTestsBase.g.cs index 829e9af12b..cec680eca1 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/CapacitanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/CapacitanceTestsBase.g.cs @@ -608,8 +608,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Capacitance.FromFarads(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {Capacitance.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(Capacitance.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/CoefficientOfThermalExpansionTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/CoefficientOfThermalExpansionTestsBase.g.cs index 6efc08654e..761ba1d4ef 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/CoefficientOfThermalExpansionTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/CoefficientOfThermalExpansionTestsBase.g.cs @@ -548,8 +548,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = CoefficientOfThermalExpansion.FromInverseKelvin(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {CoefficientOfThermalExpansion.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(CoefficientOfThermalExpansion.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/DensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/DensityTestsBase.g.cs index f2e8daf328..f6b44dde28 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/DensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/DensityTestsBase.g.cs @@ -1103,8 +1103,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Density.FromKilogramsPerCubicMeter(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {Density.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(Density.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/DurationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/DurationTestsBase.g.cs index 854004bc3e..3483286a47 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/DurationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/DurationTestsBase.g.cs @@ -653,8 +653,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Duration.FromSeconds(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {Duration.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(Duration.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/DynamicViscosityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/DynamicViscosityTestsBase.g.cs index efc2f5d8c4..e38b5aa26f 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/DynamicViscosityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/DynamicViscosityTestsBase.g.cs @@ -653,8 +653,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = DynamicViscosity.FromNewtonSecondsPerMeterSquared(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {DynamicViscosity.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(DynamicViscosity.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricAdmittanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricAdmittanceTestsBase.g.cs index 35392f75e7..1489048aa5 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricAdmittanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricAdmittanceTestsBase.g.cs @@ -563,8 +563,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ElectricAdmittance.FromSiemens(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {ElectricAdmittance.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(ElectricAdmittance.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeDensityTestsBase.g.cs index 1ab12065b5..b827594845 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeDensityTestsBase.g.cs @@ -518,8 +518,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ElectricChargeDensity.FromCoulombsPerCubicMeter(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {ElectricChargeDensity.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(ElectricChargeDensity.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeTestsBase.g.cs index 040c055d86..560209e2b1 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeTestsBase.g.cs @@ -578,8 +578,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ElectricCharge.FromCoulombs(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {ElectricCharge.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(ElectricCharge.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductanceTestsBase.g.cs index 908eff309b..9f22e1e05d 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductanceTestsBase.g.cs @@ -548,8 +548,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ElectricConductance.FromSiemens(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {ElectricConductance.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(ElectricConductance.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductivityTestsBase.g.cs index 8dbee97d5a..7f748b5017 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductivityTestsBase.g.cs @@ -548,8 +548,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ElectricConductivity.FromSiemensPerMeter(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {ElectricConductivity.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(ElectricConductivity.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentDensityTestsBase.g.cs index 46a6e1e857..afdfc00d99 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentDensityTestsBase.g.cs @@ -548,8 +548,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ElectricCurrentDensity.FromAmperesPerSquareMeter(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {ElectricCurrentDensity.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(ElectricCurrentDensity.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentGradientTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentGradientTestsBase.g.cs index ef59a72d24..8044061a52 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentGradientTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentGradientTestsBase.g.cs @@ -518,8 +518,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ElectricCurrentGradient.FromAmperesPerSecond(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {ElectricCurrentGradient.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(ElectricCurrentGradient.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentTestsBase.g.cs index 65c609270e..c1f02ee53b 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentTestsBase.g.cs @@ -623,8 +623,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ElectricCurrent.FromAmperes(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {ElectricCurrent.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(ElectricCurrent.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricFieldTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricFieldTestsBase.g.cs index 21ce06049a..c9b7e1a591 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricFieldTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricFieldTestsBase.g.cs @@ -518,8 +518,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ElectricField.FromVoltsPerMeter(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {ElectricField.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(ElectricField.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricInductanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricInductanceTestsBase.g.cs index c32c967a10..52d47a0b55 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricInductanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricInductanceTestsBase.g.cs @@ -563,8 +563,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ElectricInductance.FromHenries(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {ElectricInductance.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(ElectricInductance.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialAcTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialAcTestsBase.g.cs index d50a31da7d..d879e4cc00 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialAcTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialAcTestsBase.g.cs @@ -578,8 +578,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ElectricPotentialAc.FromVoltsAc(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {ElectricPotentialAc.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(ElectricPotentialAc.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialChangeRateTestsBase.g.cs index 96ff12813b..ac21bdca33 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialChangeRateTestsBase.g.cs @@ -803,8 +803,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ElectricPotentialChangeRate.FromVoltsPerSeconds(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {ElectricPotentialChangeRate.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(ElectricPotentialChangeRate.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialDcTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialDcTestsBase.g.cs index 20f8445002..72151482ba 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialDcTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialDcTestsBase.g.cs @@ -578,8 +578,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ElectricPotentialDc.FromVoltsDc(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {ElectricPotentialDc.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(ElectricPotentialDc.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialTestsBase.g.cs index 272aea5bdd..74f892aa69 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialTestsBase.g.cs @@ -578,8 +578,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ElectricPotential.FromVolts(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {ElectricPotential.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(ElectricPotential.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistanceTestsBase.g.cs index 8b1a813669..b331c74ea2 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistanceTestsBase.g.cs @@ -593,8 +593,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ElectricResistance.FromOhms(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {ElectricResistance.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(ElectricResistance.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistivityTestsBase.g.cs index 9b3f6b4b06..7919d8a9d0 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistivityTestsBase.g.cs @@ -713,8 +713,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ElectricResistivity.FromOhmMeters(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {ElectricResistivity.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(ElectricResistivity.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricSurfaceChargeDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricSurfaceChargeDensityTestsBase.g.cs index 189d4861f0..5f97b56c27 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricSurfaceChargeDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricSurfaceChargeDensityTestsBase.g.cs @@ -548,8 +548,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ElectricSurfaceChargeDensity.FromCoulombsPerSquareMeter(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {ElectricSurfaceChargeDensity.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(ElectricSurfaceChargeDensity.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/EnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/EnergyTestsBase.g.cs index 4c4e8fd990..c924265d6b 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/EnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/EnergyTestsBase.g.cs @@ -1043,8 +1043,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Energy.FromJoules(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {Energy.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(Energy.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/EntropyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/EntropyTestsBase.g.cs index a5d545d675..adba23f747 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/EntropyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/EntropyTestsBase.g.cs @@ -608,8 +608,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Entropy.FromJoulesPerKelvin(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {Entropy.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(Entropy.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ForceChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ForceChangeRateTestsBase.g.cs index bccad81618..5b4de2de15 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ForceChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ForceChangeRateTestsBase.g.cs @@ -668,8 +668,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ForceChangeRate.FromNewtonsPerSecond(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {ForceChangeRate.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(ForceChangeRate.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ForcePerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ForcePerLengthTestsBase.g.cs index 0aac5ff592..f842642c01 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ForcePerLengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ForcePerLengthTestsBase.g.cs @@ -1073,8 +1073,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ForcePerLength.FromNewtonsPerMeter(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {ForcePerLength.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(ForcePerLength.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ForceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ForceTestsBase.g.cs index 6c8329846a..5e6567e098 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ForceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ForceTestsBase.g.cs @@ -728,8 +728,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Force.FromNewtons(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {Force.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(Force.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/FrequencyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/FrequencyTestsBase.g.cs index ec227e9f89..af36ca357c 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/FrequencyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/FrequencyTestsBase.g.cs @@ -653,8 +653,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Frequency.FromHertz(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {Frequency.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(Frequency.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/FuelEfficiencyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/FuelEfficiencyTestsBase.g.cs index 7515fe4551..e790a633b9 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/FuelEfficiencyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/FuelEfficiencyTestsBase.g.cs @@ -563,8 +563,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = FuelEfficiency.FromLitersPer100Kilometers(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {FuelEfficiency.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(FuelEfficiency.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/HeatFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/HeatFluxTestsBase.g.cs index 62c5d33e73..52b28625c8 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/HeatFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/HeatFluxTestsBase.g.cs @@ -773,8 +773,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = HeatFlux.FromWattsPerSquareMeter(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {HeatFlux.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(HeatFlux.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/HeatTransferCoefficientTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/HeatTransferCoefficientTestsBase.g.cs index 94cb15c74f..c14a5b227b 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/HeatTransferCoefficientTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/HeatTransferCoefficientTestsBase.g.cs @@ -548,8 +548,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = HeatTransferCoefficient.FromWattsPerSquareMeterKelvin(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {HeatTransferCoefficient.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(HeatTransferCoefficient.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/IlluminanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/IlluminanceTestsBase.g.cs index 855f6572d9..2e7fb1647c 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/IlluminanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/IlluminanceTestsBase.g.cs @@ -563,8 +563,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Illuminance.FromLux(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {Illuminance.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(Illuminance.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/InformationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/InformationTestsBase.g.cs index ef6f4b4e72..b02cd52cb8 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/InformationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/InformationTestsBase.g.cs @@ -861,8 +861,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Information.FromBits(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {Information.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(Information.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/IrradianceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/IrradianceTestsBase.g.cs index 972cf4c0f3..be4e396589 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/IrradianceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/IrradianceTestsBase.g.cs @@ -713,8 +713,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Irradiance.FromWattsPerSquareMeter(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {Irradiance.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(Irradiance.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/IrradiationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/IrradiationTestsBase.g.cs index 8ca09d4ef2..f861058491 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/IrradiationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/IrradiationTestsBase.g.cs @@ -608,8 +608,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Irradiation.FromJoulesPerSquareMeter(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {Irradiation.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(Irradiation.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/KinematicViscosityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/KinematicViscosityTestsBase.g.cs index 3643d66503..570dd45389 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/KinematicViscosityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/KinematicViscosityTestsBase.g.cs @@ -623,8 +623,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = KinematicViscosity.FromSquareMetersPerSecond(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {KinematicViscosity.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(KinematicViscosity.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LapseRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LapseRateTestsBase.g.cs index bdf1f683e4..5b2ea4aa80 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LapseRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LapseRateTestsBase.g.cs @@ -518,8 +518,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = LapseRate.FromDegreesCelciusPerKilometer(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {LapseRate.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(LapseRate.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LengthTestsBase.g.cs index 5ac8089f6d..01eeca8257 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LengthTestsBase.g.cs @@ -998,8 +998,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Length.FromMeters(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {Length.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(Length.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LevelTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LevelTestsBase.g.cs index c2d58e36da..85f62f1e71 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LevelTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LevelTestsBase.g.cs @@ -537,8 +537,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Level.FromDecibels(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {Level.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(Level.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LinearDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LinearDensityTestsBase.g.cs index eb129ca527..8ac4f484f0 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LinearDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LinearDensityTestsBase.g.cs @@ -713,8 +713,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = LinearDensity.FromKilogramsPerMeter(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {LinearDensity.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(LinearDensity.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LinearPowerDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LinearPowerDensityTestsBase.g.cs index 4ea6a2168b..a301255fe0 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LinearPowerDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LinearPowerDensityTestsBase.g.cs @@ -878,8 +878,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = LinearPowerDensity.FromWattsPerMeter(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {LinearPowerDensity.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(LinearPowerDensity.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminosityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminosityTestsBase.g.cs index f27fcdcd30..7a7408b890 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminosityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminosityTestsBase.g.cs @@ -713,8 +713,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Luminosity.FromWatts(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {Luminosity.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(Luminosity.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousFluxTestsBase.g.cs index 730f65487a..cac961e4aa 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousFluxTestsBase.g.cs @@ -518,8 +518,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = LuminousFlux.FromLumens(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {LuminousFlux.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(LuminousFlux.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousIntensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousIntensityTestsBase.g.cs index e4cf57dc90..a85370801b 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousIntensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousIntensityTestsBase.g.cs @@ -518,8 +518,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = LuminousIntensity.FromCandela(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {LuminousIntensity.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(LuminousIntensity.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFieldTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFieldTestsBase.g.cs index 2781f6a6f1..3cd3563a0e 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFieldTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFieldTestsBase.g.cs @@ -563,8 +563,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = MagneticField.FromTeslas(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {MagneticField.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(MagneticField.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFluxTestsBase.g.cs index 07539b584c..f9d222ea86 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFluxTestsBase.g.cs @@ -518,8 +518,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = MagneticFlux.FromWebers(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {MagneticFlux.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(MagneticFlux.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MagnetizationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MagnetizationTestsBase.g.cs index 832a09d2ba..818f70faf7 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MagnetizationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MagnetizationTestsBase.g.cs @@ -518,8 +518,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Magnetization.FromAmperesPerMeter(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {Magnetization.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(Magnetization.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MassConcentrationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MassConcentrationTestsBase.g.cs index e22b3ca1b2..21a8738d97 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MassConcentrationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MassConcentrationTestsBase.g.cs @@ -1103,8 +1103,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = MassConcentration.FromKilogramsPerCubicMeter(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {MassConcentration.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(MassConcentration.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MassFlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MassFlowTestsBase.g.cs index 7220845dee..e12e2766b5 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MassFlowTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MassFlowTestsBase.g.cs @@ -998,8 +998,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = MassFlow.FromGramsPerSecond(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {MassFlow.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(MassFlow.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MassFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MassFluxTestsBase.g.cs index b4129d3a67..a38c80050d 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MassFluxTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MassFluxTestsBase.g.cs @@ -683,8 +683,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = MassFlux.FromKilogramsPerSecondPerSquareMeter(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {MassFlux.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(MassFlux.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MassFractionTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MassFractionTestsBase.g.cs index 6d640b7716..f20668a6a7 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MassFractionTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MassFractionTestsBase.g.cs @@ -863,8 +863,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = MassFraction.FromDecimalFractions(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {MassFraction.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(MassFraction.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MassMomentOfInertiaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MassMomentOfInertiaTestsBase.g.cs index 1e5f775c65..81eacc082f 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MassMomentOfInertiaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MassMomentOfInertiaTestsBase.g.cs @@ -923,8 +923,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = MassMomentOfInertia.FromKilogramSquareMeters(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {MassMomentOfInertia.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(MassMomentOfInertia.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MassTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MassTestsBase.g.cs index 6bf53ebf5a..d86427d26b 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MassTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MassTestsBase.g.cs @@ -878,8 +878,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Mass.FromKilograms(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {Mass.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(Mass.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEnergyTestsBase.g.cs index 093b44970f..f3fa928cdd 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEnergyTestsBase.g.cs @@ -548,8 +548,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = MolarEnergy.FromJoulesPerMole(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {MolarEnergy.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(MolarEnergy.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEntropyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEntropyTestsBase.g.cs index f447092eb3..c9cfa55d2f 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEntropyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEntropyTestsBase.g.cs @@ -548,8 +548,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = MolarEntropy.FromJoulesPerMoleKelvin(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {MolarEntropy.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(MolarEntropy.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarMassTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarMassTestsBase.g.cs index 2335d0a4bb..05dc2b67cf 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarMassTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarMassTestsBase.g.cs @@ -683,8 +683,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = MolarMass.FromKilogramsPerMole(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {MolarMass.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(MolarMass.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarityTestsBase.g.cs index bc6fd40614..55afa9097d 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarityTestsBase.g.cs @@ -623,8 +623,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Molarity.FromMolesPerCubicMeter(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {Molarity.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(Molarity.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PermeabilityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PermeabilityTestsBase.g.cs index 55015cda0b..385bdbd6c2 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/PermeabilityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PermeabilityTestsBase.g.cs @@ -518,8 +518,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Permeability.FromHenriesPerMeter(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {Permeability.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(Permeability.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PermittivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PermittivityTestsBase.g.cs index 9061a266f2..e4253fb0da 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/PermittivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PermittivityTestsBase.g.cs @@ -518,8 +518,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Permittivity.FromFaradsPerMeter(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {Permittivity.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(Permittivity.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PowerDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PowerDensityTestsBase.g.cs index e653fcb336..981c59e6d4 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/PowerDensityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PowerDensityTestsBase.g.cs @@ -1163,8 +1163,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = PowerDensity.FromWattsPerCubicMeter(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {PowerDensity.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(PowerDensity.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PowerRatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PowerRatioTestsBase.g.cs index 97af4f8780..2995bef291 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/PowerRatioTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PowerRatioTestsBase.g.cs @@ -537,8 +537,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = PowerRatio.FromDecibelWatts(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {PowerRatio.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(PowerRatio.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PowerTestsBase.g.cs index f5030fc965..cae66a22e0 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/PowerTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PowerTestsBase.g.cs @@ -846,8 +846,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Power.FromWatts(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {Power.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(Power.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PressureChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PressureChangeRateTestsBase.g.cs index cfe2790a48..fad33dedca 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/PressureChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PressureChangeRateTestsBase.g.cs @@ -608,8 +608,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = PressureChangeRate.FromPascalsPerSecond(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {PressureChangeRate.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(PressureChangeRate.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PressureTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PressureTestsBase.g.cs index e87f994dc3..964144a717 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/PressureTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PressureTestsBase.g.cs @@ -1133,8 +1133,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Pressure.FromPascals(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {Pressure.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(Pressure.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RatioChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RatioChangeRateTestsBase.g.cs index 35fd27f700..77df714365 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RatioChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RatioChangeRateTestsBase.g.cs @@ -533,8 +533,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = RatioChangeRate.FromDecimalFractionsPerSecond(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {RatioChangeRate.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(RatioChangeRate.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RatioTestsBase.g.cs index c5a5d25d23..576a8276e8 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RatioTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RatioTestsBase.g.cs @@ -593,8 +593,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Ratio.FromDecimalFractions(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {Ratio.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(Ratio.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ReactiveEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ReactiveEnergyTestsBase.g.cs index c742b26060..62e319a3ad 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ReactiveEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ReactiveEnergyTestsBase.g.cs @@ -548,8 +548,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ReactiveEnergy.FromVoltampereReactiveHours(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {ReactiveEnergy.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(ReactiveEnergy.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ReactivePowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ReactivePowerTestsBase.g.cs index 82cec2ab4a..cc25da994d 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ReactivePowerTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ReactivePowerTestsBase.g.cs @@ -563,8 +563,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ReactivePower.FromVoltamperesReactive(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {ReactivePower.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(ReactivePower.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalAccelerationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalAccelerationTestsBase.g.cs index a61156f44e..96aec34dcd 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalAccelerationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalAccelerationTestsBase.g.cs @@ -563,8 +563,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = RotationalAcceleration.FromRadiansPerSecondSquared(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {RotationalAcceleration.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(RotationalAcceleration.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalSpeedTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalSpeedTestsBase.g.cs index 5ed0c0c524..a78d9dff63 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalSpeedTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalSpeedTestsBase.g.cs @@ -698,8 +698,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = RotationalSpeed.FromRadiansPerSecond(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {RotationalSpeed.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(RotationalSpeed.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessPerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessPerLengthTestsBase.g.cs index cd53a1a379..5e7dc77aa8 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessPerLengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessPerLengthTestsBase.g.cs @@ -578,8 +578,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = RotationalStiffnessPerLength.FromNewtonMetersPerRadianPerMeter(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {RotationalStiffnessPerLength.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(RotationalStiffnessPerLength.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessTestsBase.g.cs index c47a7b34d4..8843cfcbe7 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessTestsBase.g.cs @@ -998,8 +998,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = RotationalStiffness.FromNewtonMetersPerRadian(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {RotationalStiffness.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(RotationalStiffness.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/SolidAngleTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/SolidAngleTestsBase.g.cs index 54662a72b3..36b873c50e 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/SolidAngleTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/SolidAngleTestsBase.g.cs @@ -518,8 +518,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = SolidAngle.FromSteradians(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {SolidAngle.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(SolidAngle.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEnergyTestsBase.g.cs index 6a44de8003..e2ad1a883c 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEnergyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEnergyTestsBase.g.cs @@ -878,8 +878,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = SpecificEnergy.FromJoulesPerKilogram(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {SpecificEnergy.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(SpecificEnergy.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEntropyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEntropyTestsBase.g.cs index ff28fe14ed..d166e13663 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEntropyTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEntropyTestsBase.g.cs @@ -638,8 +638,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = SpecificEntropy.FromJoulesPerKilogramKelvin(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {SpecificEntropy.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(SpecificEntropy.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificVolumeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificVolumeTestsBase.g.cs index 3d1d4dbbe5..7fc434ceb8 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificVolumeTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificVolumeTestsBase.g.cs @@ -548,8 +548,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = SpecificVolume.FromCubicMetersPerKilogram(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {SpecificVolume.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(SpecificVolume.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificWeightTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificWeightTestsBase.g.cs index 3f17675495..219157f006 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificWeightTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificWeightTestsBase.g.cs @@ -758,8 +758,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = SpecificWeight.FromNewtonsPerCubicMeter(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {SpecificWeight.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(SpecificWeight.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/SpeedTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/SpeedTestsBase.g.cs index 45d828abfa..d9ef037f0e 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/SpeedTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/SpeedTestsBase.g.cs @@ -983,8 +983,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Speed.FromMetersPerSecond(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {Speed.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(Speed.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureChangeRateTestsBase.g.cs index fd456c5965..48d41b585a 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureChangeRateTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureChangeRateTestsBase.g.cs @@ -653,8 +653,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = TemperatureChangeRate.FromDegreesCelsiusPerSecond(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {TemperatureChangeRate.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(TemperatureChangeRate.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureDeltaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureDeltaTestsBase.g.cs index 9403137b93..1e82e20222 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureDeltaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureDeltaTestsBase.g.cs @@ -638,8 +638,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = TemperatureDelta.FromKelvins(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {TemperatureDelta.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(TemperatureDelta.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureTestsBase.g.cs index 660398ceb9..ad8693359f 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureTestsBase.g.cs @@ -641,8 +641,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Temperature.FromKelvins(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {Temperature.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(Temperature.QuantityType.GetHashCode(), quantity.GetHashCode()); } } diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalConductivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalConductivityTestsBase.g.cs index 127c0cc775..7a7ca5a598 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalConductivityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalConductivityTestsBase.g.cs @@ -533,8 +533,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ThermalConductivity.FromWattsPerMeterKelvin(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {ThermalConductivity.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(ThermalConductivity.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalResistanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalResistanceTestsBase.g.cs index 1351b8b51d..2cfb3d227e 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalResistanceTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalResistanceTestsBase.g.cs @@ -578,8 +578,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = ThermalResistance.FromSquareMeterKelvinsPerKilowatt(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {ThermalResistance.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(ThermalResistance.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/TorquePerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/TorquePerLengthTestsBase.g.cs index d74db2e6e2..836cbe1a9a 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/TorquePerLengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/TorquePerLengthTestsBase.g.cs @@ -818,8 +818,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = TorquePerLength.FromNewtonMetersPerMeter(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {TorquePerLength.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(TorquePerLength.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/TorqueTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/TorqueTestsBase.g.cs index 03cd44c36f..a2168d012d 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/TorqueTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/TorqueTestsBase.g.cs @@ -818,8 +818,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Torque.FromNewtonMeters(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {Torque.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(Torque.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VitaminATestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VitaminATestsBase.g.cs index e88fe299e3..408fa9660c 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/VitaminATestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VitaminATestsBase.g.cs @@ -518,8 +518,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = VitaminA.FromInternationalUnits(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {VitaminA.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(VitaminA.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeConcentrationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeConcentrationTestsBase.g.cs index 084dbe4071..b435628767 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeConcentrationTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeConcentrationTestsBase.g.cs @@ -803,8 +803,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = VolumeConcentration.FromDecimalFractions(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {VolumeConcentration.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(VolumeConcentration.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowTestsBase.g.cs index 073429397e..31883ddace 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowTestsBase.g.cs @@ -1238,8 +1238,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = VolumeFlow.FromCubicMetersPerSecond(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {VolumeFlow.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(VolumeFlow.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumePerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumePerLengthTestsBase.g.cs index d1901192f6..39437b27f9 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumePerLengthTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumePerLengthTestsBase.g.cs @@ -608,8 +608,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = VolumePerLength.FromCubicMetersPerMeter(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {VolumePerLength.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(VolumePerLength.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeTestsBase.g.cs index f691b970b7..9cc072ee9c 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeTestsBase.g.cs @@ -1268,8 +1268,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Volume.FromCubicMeters(1.0); - var roundedBaseValue = Math.Round(quantity.ToBaseUnit().Value, 5); - Assert.Equal(new {Volume.QuantityType, roundedBaseValue}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(Volume.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs b/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs index 9033a92cbc..d8c91063f2 100644 --- a/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs @@ -678,7 +678,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Acceleration other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -738,8 +738,7 @@ public bool Equals(Acceleration other, double tolerance, ComparisonType comparis /// A hash code for the current Acceleration. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs index b1f936a4b1..9f0ece7893 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs @@ -693,7 +693,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(AmountOfSubstance other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -753,8 +753,7 @@ public bool Equals(AmountOfSubstance other, double tolerance, ComparisonType com /// A hash code for the current AmountOfSubstance. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs index ae5c151236..1fe4afc170 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs @@ -536,7 +536,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(AmplitudeRatio other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -596,8 +596,7 @@ public bool Equals(AmplitudeRatio other, double tolerance, ComparisonType compar /// A hash code for the current AmplitudeRatio. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Angle.g.cs b/UnitsNet/GeneratedCode/Quantities/Angle.g.cs index 5d88488e68..5cd12cc882 100644 --- a/UnitsNet/GeneratedCode/Quantities/Angle.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Angle.g.cs @@ -678,7 +678,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Angle other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -738,8 +738,7 @@ public bool Equals(Angle other, double tolerance, ComparisonType comparisonType) /// A hash code for the current Angle. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs index a3945f82b6..a51e942342 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs @@ -513,7 +513,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ApparentEnergy other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -573,8 +573,7 @@ public bool Equals(ApparentEnergy other, double tolerance, ComparisonType compar /// A hash code for the current ApparentEnergy. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs index be8b2f6a98..ea7e2a3db5 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs @@ -528,7 +528,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ApparentPower other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -588,8 +588,7 @@ public bool Equals(ApparentPower other, double tolerance, ComparisonType compari /// A hash code for the current ApparentPower. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Area.g.cs b/UnitsNet/GeneratedCode/Quantities/Area.g.cs index 4dae298a3a..086dd459e6 100644 --- a/UnitsNet/GeneratedCode/Quantities/Area.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Area.g.cs @@ -678,7 +678,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Area other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -738,8 +738,7 @@ public bool Equals(Area other, double tolerance, ComparisonType comparisonType) /// A hash code for the current Area. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs index d4a26fcf4a..2be435155d 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs @@ -483,7 +483,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(AreaDensity other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -543,8 +543,7 @@ public bool Equals(AreaDensity other, double tolerance, ComparisonType compariso /// A hash code for the current AreaDensity. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs index 161eb43840..939a0e23b3 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs @@ -558,7 +558,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(AreaMomentOfInertia other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -618,8 +618,7 @@ public bool Equals(AreaMomentOfInertia other, double tolerance, ComparisonType c /// A hash code for the current AreaMomentOfInertia. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs b/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs index 947f31b25d..e0a8a1bb78 100644 --- a/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs @@ -863,7 +863,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(BitRate other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -923,8 +923,7 @@ public bool Equals(BitRate other, double tolerance, ComparisonType comparisonTyp /// A hash code for the current BitRate. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs index e2be0a95e8..371569bbaa 100644 --- a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs @@ -513,7 +513,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(BrakeSpecificFuelConsumption other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -573,8 +573,7 @@ public bool Equals(BrakeSpecificFuelConsumption other, double tolerance, Compari /// A hash code for the current BrakeSpecificFuelConsumption. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Capacitance.g.cs b/UnitsNet/GeneratedCode/Quantities/Capacitance.g.cs index 973301f5e0..63aa733c07 100644 --- a/UnitsNet/GeneratedCode/Quantities/Capacitance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Capacitance.g.cs @@ -576,7 +576,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Capacitance other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -636,8 +636,7 @@ public bool Equals(Capacitance other, double tolerance, ComparisonType compariso /// A hash code for the current Capacitance. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs index a298e63b08..98950e47ce 100644 --- a/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs @@ -513,7 +513,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(CoefficientOfThermalExpansion other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -573,8 +573,7 @@ public bool Equals(CoefficientOfThermalExpansion other, double tolerance, Compar /// A hash code for the current CoefficientOfThermalExpansion. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Density.g.cs b/UnitsNet/GeneratedCode/Quantities/Density.g.cs index fe6f73d66b..19af0e7016 100644 --- a/UnitsNet/GeneratedCode/Quantities/Density.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Density.g.cs @@ -1071,7 +1071,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Density other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -1131,8 +1131,7 @@ public bool Equals(Density other, double tolerance, ComparisonType comparisonTyp /// A hash code for the current Density. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Duration.g.cs b/UnitsNet/GeneratedCode/Quantities/Duration.g.cs index 3770127931..0ea052a050 100644 --- a/UnitsNet/GeneratedCode/Quantities/Duration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Duration.g.cs @@ -618,7 +618,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Duration other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -678,8 +678,7 @@ public bool Equals(Duration other, double tolerance, ComparisonType comparisonTy /// A hash code for the current Duration. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs index 46fdc23a13..092d6bf105 100644 --- a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs @@ -621,7 +621,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(DynamicViscosity other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -681,8 +681,7 @@ public bool Equals(DynamicViscosity other, double tolerance, ComparisonType comp /// A hash code for the current DynamicViscosity. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs index 0337298038..661513c070 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs @@ -528,7 +528,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricAdmittance other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -588,8 +588,7 @@ public bool Equals(ElectricAdmittance other, double tolerance, ComparisonType co /// A hash code for the current ElectricAdmittance. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs index 750f7e49de..dd36096f5a 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs @@ -546,7 +546,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricCharge other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -606,8 +606,7 @@ public bool Equals(ElectricCharge other, double tolerance, ComparisonType compar /// A hash code for the current ElectricCharge. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs index 2eb85ecf72..e1402f1d81 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs @@ -486,7 +486,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricChargeDensity other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -546,8 +546,7 @@ public bool Equals(ElectricChargeDensity other, double tolerance, ComparisonType /// A hash code for the current ElectricChargeDensity. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs index 77cccb7b1b..02a299c9ab 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs @@ -516,7 +516,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricConductance other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -576,8 +576,7 @@ public bool Equals(ElectricConductance other, double tolerance, ComparisonType c /// A hash code for the current ElectricConductance. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs index e16a940e15..9ccd4dcef2 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs @@ -516,7 +516,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricConductivity other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -576,8 +576,7 @@ public bool Equals(ElectricConductivity other, double tolerance, ComparisonType /// A hash code for the current ElectricConductivity. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs index c990dc6a82..dade0e89f7 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs @@ -588,7 +588,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricCurrent other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -648,8 +648,7 @@ public bool Equals(ElectricCurrent other, double tolerance, ComparisonType compa /// A hash code for the current ElectricCurrent. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs index fa091b060b..59d42c2f82 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs @@ -516,7 +516,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricCurrentDensity other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -576,8 +576,7 @@ public bool Equals(ElectricCurrentDensity other, double tolerance, ComparisonTyp /// A hash code for the current ElectricCurrentDensity. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs index 264b9eb621..e2d7ae82ab 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs @@ -483,7 +483,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricCurrentGradient other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -543,8 +543,7 @@ public bool Equals(ElectricCurrentGradient other, double tolerance, ComparisonTy /// A hash code for the current ElectricCurrentGradient. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs index dd8e3496f0..b18964ad7d 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs @@ -486,7 +486,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricField other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -546,8 +546,7 @@ public bool Equals(ElectricField other, double tolerance, ComparisonType compari /// A hash code for the current ElectricField. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs index ec4d9ce449..ec77b4d4ec 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs @@ -531,7 +531,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricInductance other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -591,8 +591,7 @@ public bool Equals(ElectricInductance other, double tolerance, ComparisonType co /// A hash code for the current ElectricInductance. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs index 04054d4b89..d80c8a5091 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs @@ -543,7 +543,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricPotential other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -603,8 +603,7 @@ public bool Equals(ElectricPotential other, double tolerance, ComparisonType com /// A hash code for the current ElectricPotential. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.g.cs index 00a69cb5d3..e30478c921 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.g.cs @@ -543,7 +543,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricPotentialAc other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -603,8 +603,7 @@ public bool Equals(ElectricPotentialAc other, double tolerance, ComparisonType c /// A hash code for the current ElectricPotentialAc. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs index e8646109a5..39fd2ec898 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs @@ -768,7 +768,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricPotentialChangeRate other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -828,8 +828,7 @@ public bool Equals(ElectricPotentialChangeRate other, double tolerance, Comparis /// A hash code for the current ElectricPotentialChangeRate. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.g.cs index 1374275ef0..ae3ce4bcb6 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.g.cs @@ -543,7 +543,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricPotentialDc other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -603,8 +603,7 @@ public bool Equals(ElectricPotentialDc other, double tolerance, ComparisonType c /// A hash code for the current ElectricPotentialDc. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs index bd8f628f6d..5b2ba801e8 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs @@ -558,7 +558,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricResistance other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -618,8 +618,7 @@ public bool Equals(ElectricResistance other, double tolerance, ComparisonType co /// A hash code for the current ElectricResistance. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs index 8c0f76ca20..bbf999ae94 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs @@ -681,7 +681,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricResistivity other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -741,8 +741,7 @@ public bool Equals(ElectricResistivity other, double tolerance, ComparisonType c /// A hash code for the current ElectricResistivity. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs index 373d8162f8..20031c514b 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs @@ -516,7 +516,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ElectricSurfaceChargeDensity other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -576,8 +576,7 @@ public bool Equals(ElectricSurfaceChargeDensity other, double tolerance, Compari /// A hash code for the current ElectricSurfaceChargeDensity. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Energy.g.cs b/UnitsNet/GeneratedCode/Quantities/Energy.g.cs index 805a10b75b..9e9ccac1d5 100644 --- a/UnitsNet/GeneratedCode/Quantities/Energy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Energy.g.cs @@ -1008,7 +1008,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Energy other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -1068,8 +1068,7 @@ public bool Equals(Energy other, double tolerance, ComparisonType comparisonType /// A hash code for the current Energy. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs b/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs index 4ba72cd81c..e1d0e80167 100644 --- a/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs @@ -573,7 +573,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Entropy other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -633,8 +633,7 @@ public bool Equals(Entropy other, double tolerance, ComparisonType comparisonTyp /// A hash code for the current Entropy. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Force.g.cs b/UnitsNet/GeneratedCode/Quantities/Force.g.cs index 071b96b4a3..6bb965ce99 100644 --- a/UnitsNet/GeneratedCode/Quantities/Force.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Force.g.cs @@ -693,7 +693,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Force other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -753,8 +753,7 @@ public bool Equals(Force other, double tolerance, ComparisonType comparisonType) /// A hash code for the current Force. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs index 0941f50ea7..c05fabebdb 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs @@ -633,7 +633,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ForceChangeRate other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -693,8 +693,7 @@ public bool Equals(ForceChangeRate other, double tolerance, ComparisonType compa /// A hash code for the current ForceChangeRate. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs index 1a2a14cb2c..ec112bf932 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs @@ -1038,7 +1038,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ForcePerLength other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -1098,8 +1098,7 @@ public bool Equals(ForcePerLength other, double tolerance, ComparisonType compar /// A hash code for the current ForcePerLength. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs b/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs index 359f7a1ee2..3950245c34 100644 --- a/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs @@ -618,7 +618,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Frequency other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -678,8 +678,7 @@ public bool Equals(Frequency other, double tolerance, ComparisonType comparisonT /// A hash code for the current Frequency. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs b/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs index 024c813bc7..a4a58846db 100644 --- a/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs @@ -531,7 +531,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(FuelEfficiency other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -591,8 +591,7 @@ public bool Equals(FuelEfficiency other, double tolerance, ComparisonType compar /// A hash code for the current FuelEfficiency. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs index bc93d0068d..c3c101411a 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs @@ -738,7 +738,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(HeatFlux other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -798,8 +798,7 @@ public bool Equals(HeatFlux other, double tolerance, ComparisonType comparisonTy /// A hash code for the current HeatFlux. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs index e2ba9cfe96..a746d06f1c 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs @@ -513,7 +513,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(HeatTransferCoefficient other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -573,8 +573,7 @@ public bool Equals(HeatTransferCoefficient other, double tolerance, ComparisonTy /// A hash code for the current HeatTransferCoefficient. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs b/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs index 14f4231a39..7b4d458695 100644 --- a/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs @@ -531,7 +531,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Illuminance other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -591,8 +591,7 @@ public bool Equals(Illuminance other, double tolerance, ComparisonType compariso /// A hash code for the current Illuminance. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Information.g.cs b/UnitsNet/GeneratedCode/Quantities/Information.g.cs index 039bfca8dd..ece4b51e3b 100644 --- a/UnitsNet/GeneratedCode/Quantities/Information.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Information.g.cs @@ -860,7 +860,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Information other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -920,8 +920,7 @@ public bool Equals(Information other, double tolerance, ComparisonType compariso /// A hash code for the current Information. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs index 8f1ac156de..bd9315b623 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs @@ -678,7 +678,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Irradiance other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -738,8 +738,7 @@ public bool Equals(Irradiance other, double tolerance, ComparisonType comparison /// A hash code for the current Irradiance. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs index 7e8d41647e..a3b09ac642 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs @@ -576,7 +576,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Irradiation other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -636,8 +636,7 @@ public bool Equals(Irradiation other, double tolerance, ComparisonType compariso /// A hash code for the current Irradiation. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs index d060940bfd..6facf9abe5 100644 --- a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs @@ -591,7 +591,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(KinematicViscosity other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -651,8 +651,7 @@ public bool Equals(KinematicViscosity other, double tolerance, ComparisonType co /// A hash code for the current KinematicViscosity. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/LapseRate.g.cs b/UnitsNet/GeneratedCode/Quantities/LapseRate.g.cs index ef346098b1..bc366820ab 100644 --- a/UnitsNet/GeneratedCode/Quantities/LapseRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LapseRate.g.cs @@ -483,7 +483,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(LapseRate other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -543,8 +543,7 @@ public bool Equals(LapseRate other, double tolerance, ComparisonType comparisonT /// A hash code for the current LapseRate. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Length.g.cs b/UnitsNet/GeneratedCode/Quantities/Length.g.cs index aad805737e..bd9a897fdd 100644 --- a/UnitsNet/GeneratedCode/Quantities/Length.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Length.g.cs @@ -963,7 +963,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Length other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -1023,8 +1023,7 @@ public bool Equals(Length other, double tolerance, ComparisonType comparisonType /// A hash code for the current Length. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Level.g.cs b/UnitsNet/GeneratedCode/Quantities/Level.g.cs index 4c9718dcad..d6cb47ce62 100644 --- a/UnitsNet/GeneratedCode/Quantities/Level.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Level.g.cs @@ -506,7 +506,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Level other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -566,8 +566,7 @@ public bool Equals(Level other, double tolerance, ComparisonType comparisonType) /// A hash code for the current Level. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs index 20a276807d..f27fd698fa 100644 --- a/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs @@ -681,7 +681,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(LinearDensity other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -741,8 +741,7 @@ public bool Equals(LinearDensity other, double tolerance, ComparisonType compari /// A hash code for the current LinearDensity. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs index a3d3c86d2d..c72386b4b4 100644 --- a/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs @@ -846,7 +846,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(LinearPowerDensity other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -906,8 +906,7 @@ public bool Equals(LinearPowerDensity other, double tolerance, ComparisonType co /// A hash code for the current LinearPowerDensity. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs b/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs index 3993c3c34a..91299090d0 100644 --- a/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs @@ -681,7 +681,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Luminosity other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -741,8 +741,7 @@ public bool Equals(Luminosity other, double tolerance, ComparisonType comparison /// A hash code for the current Luminosity. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs index e3290fa07b..75a0f4327f 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs @@ -486,7 +486,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(LuminousFlux other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -546,8 +546,7 @@ public bool Equals(LuminousFlux other, double tolerance, ComparisonType comparis /// A hash code for the current LuminousFlux. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs index 28ca8e8d84..6bb4345545 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs @@ -486,7 +486,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(LuminousIntensity other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -546,8 +546,7 @@ public bool Equals(LuminousIntensity other, double tolerance, ComparisonType com /// A hash code for the current LuminousIntensity. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs index aed0b346f0..4862ef60d9 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs @@ -531,7 +531,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(MagneticField other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -591,8 +591,7 @@ public bool Equals(MagneticField other, double tolerance, ComparisonType compari /// A hash code for the current MagneticField. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs index 839e7412bf..a58f2c0a56 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs @@ -486,7 +486,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(MagneticFlux other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -546,8 +546,7 @@ public bool Equals(MagneticFlux other, double tolerance, ComparisonType comparis /// A hash code for the current MagneticFlux. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs b/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs index 091772100e..81a3809e26 100644 --- a/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs @@ -486,7 +486,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Magnetization other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -546,8 +546,7 @@ public bool Equals(Magnetization other, double tolerance, ComparisonType compari /// A hash code for the current Magnetization. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Mass.g.cs b/UnitsNet/GeneratedCode/Quantities/Mass.g.cs index 1feebf592a..27e90f3efb 100644 --- a/UnitsNet/GeneratedCode/Quantities/Mass.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Mass.g.cs @@ -843,7 +843,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Mass other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -903,8 +903,7 @@ public bool Equals(Mass other, double tolerance, ComparisonType comparisonType) /// A hash code for the current Mass. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs b/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs index 3d4925a8e6..26106437f0 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs @@ -1071,7 +1071,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(MassConcentration other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -1131,8 +1131,7 @@ public bool Equals(MassConcentration other, double tolerance, ComparisonType com /// A hash code for the current MassConcentration. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs index da1899cbaf..e41860a208 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs @@ -963,7 +963,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(MassFlow other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -1023,8 +1023,7 @@ public bool Equals(MassFlow other, double tolerance, ComparisonType comparisonTy /// A hash code for the current MassFlow. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs index e629b9f8f9..8a6b3fffbb 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs @@ -648,7 +648,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(MassFlux other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -708,8 +708,7 @@ public bool Equals(MassFlux other, double tolerance, ComparisonType comparisonTy /// A hash code for the current MassFlux. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs index 63107c3979..2d51750b15 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs @@ -831,7 +831,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(MassFraction other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -891,8 +891,7 @@ public bool Equals(MassFraction other, double tolerance, ComparisonType comparis /// A hash code for the current MassFraction. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs index 698d1655d7..3f9ff92035 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs @@ -888,7 +888,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(MassMomentOfInertia other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -948,8 +948,7 @@ public bool Equals(MassMomentOfInertia other, double tolerance, ComparisonType c /// A hash code for the current MassMomentOfInertia. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs index ad3e5bdd46..181b4f2545 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs @@ -513,7 +513,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(MolarEnergy other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -573,8 +573,7 @@ public bool Equals(MolarEnergy other, double tolerance, ComparisonType compariso /// A hash code for the current MolarEnergy. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs index cc6bc00cb7..1b16bc261c 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs @@ -513,7 +513,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(MolarEntropy other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -573,8 +573,7 @@ public bool Equals(MolarEntropy other, double tolerance, ComparisonType comparis /// A hash code for the current MolarEntropy. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs index ea436e794c..2c27c3b2c8 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs @@ -648,7 +648,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(MolarMass other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -708,8 +708,7 @@ public bool Equals(MolarMass other, double tolerance, ComparisonType comparisonT /// A hash code for the current MolarMass. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs b/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs index 400489d928..56a2c4682b 100644 --- a/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs @@ -591,7 +591,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Molarity other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -651,8 +651,7 @@ public bool Equals(Molarity other, double tolerance, ComparisonType comparisonTy /// A hash code for the current Molarity. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs b/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs index ed075da905..4b1846b706 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs @@ -486,7 +486,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Permeability other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -546,8 +546,7 @@ public bool Equals(Permeability other, double tolerance, ComparisonType comparis /// A hash code for the current Permeability. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs b/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs index ee1dc5567d..d184539ac8 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs @@ -486,7 +486,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Permittivity other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -546,8 +546,7 @@ public bool Equals(Permittivity other, double tolerance, ComparisonType comparis /// A hash code for the current Permittivity. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Power.g.cs b/UnitsNet/GeneratedCode/Quantities/Power.g.cs index 0022859141..bc7e33b8cd 100644 --- a/UnitsNet/GeneratedCode/Quantities/Power.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Power.g.cs @@ -845,7 +845,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Power other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -905,8 +905,7 @@ public bool Equals(Power other, double tolerance, ComparisonType comparisonType) /// A hash code for the current Power. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs index b00ac8eaf0..6e096ae05d 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs @@ -1128,7 +1128,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(PowerDensity other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -1188,8 +1188,7 @@ public bool Equals(PowerDensity other, double tolerance, ComparisonType comparis /// A hash code for the current PowerDensity. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs index 40844872c2..cfbd91d6ba 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs @@ -506,7 +506,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(PowerRatio other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -566,8 +566,7 @@ public bool Equals(PowerRatio other, double tolerance, ComparisonType comparison /// A hash code for the current PowerRatio. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs b/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs index 4ca06996f5..b5b5ca956e 100644 --- a/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs @@ -1098,7 +1098,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Pressure other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -1158,8 +1158,7 @@ public bool Equals(Pressure other, double tolerance, ComparisonType comparisonTy /// A hash code for the current Pressure. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs index 808ebd8dab..76640da27a 100644 --- a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs @@ -573,7 +573,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(PressureChangeRate other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -633,8 +633,7 @@ public bool Equals(PressureChangeRate other, double tolerance, ComparisonType co /// A hash code for the current PressureChangeRate. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs b/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs index 0ca70ee707..3f12701d83 100644 --- a/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs @@ -558,7 +558,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Ratio other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -618,8 +618,7 @@ public bool Equals(Ratio other, double tolerance, ComparisonType comparisonType) /// A hash code for the current Ratio. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs index c3473bf6aa..4b1de5c3ee 100644 --- a/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs @@ -498,7 +498,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(RatioChangeRate other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -558,8 +558,7 @@ public bool Equals(RatioChangeRate other, double tolerance, ComparisonType compa /// A hash code for the current RatioChangeRate. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.g.cs index c1dd55d0a0..5c815d4bd1 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.g.cs @@ -513,7 +513,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ReactiveEnergy other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -573,8 +573,7 @@ public bool Equals(ReactiveEnergy other, double tolerance, ComparisonType compar /// A hash code for the current ReactiveEnergy. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ReactivePower.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactivePower.g.cs index 27ed42a1e9..ce8fb45e81 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactivePower.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactivePower.g.cs @@ -528,7 +528,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ReactivePower other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -588,8 +588,7 @@ public bool Equals(ReactivePower other, double tolerance, ComparisonType compari /// A hash code for the current ReactivePower. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs index e0c55cdcb7..c625496152 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs @@ -528,7 +528,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(RotationalAcceleration other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -588,8 +588,7 @@ public bool Equals(RotationalAcceleration other, double tolerance, ComparisonTyp /// A hash code for the current RotationalAcceleration. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs index 8146e96589..da2c7d64b8 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs @@ -663,7 +663,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(RotationalSpeed other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -723,8 +723,7 @@ public bool Equals(RotationalSpeed other, double tolerance, ComparisonType compa /// A hash code for the current RotationalSpeed. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs index a98191e56f..089c20d071 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs @@ -963,7 +963,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(RotationalStiffness other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -1023,8 +1023,7 @@ public bool Equals(RotationalStiffness other, double tolerance, ComparisonType c /// A hash code for the current RotationalStiffness. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs index cd7e4a6555..2f4e9c832e 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs @@ -543,7 +543,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(RotationalStiffnessPerLength other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -603,8 +603,7 @@ public bool Equals(RotationalStiffnessPerLength other, double tolerance, Compari /// A hash code for the current RotationalStiffnessPerLength. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs b/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs index 022315ec1b..3804204849 100644 --- a/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs @@ -486,7 +486,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(SolidAngle other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -546,8 +546,7 @@ public bool Equals(SolidAngle other, double tolerance, ComparisonType comparison /// A hash code for the current SolidAngle. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs index a94926bb7e..22d41a51e3 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs @@ -846,7 +846,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(SpecificEnergy other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -906,8 +906,7 @@ public bool Equals(SpecificEnergy other, double tolerance, ComparisonType compar /// A hash code for the current SpecificEnergy. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs index 76d7ef6fa7..731a30b6f9 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs @@ -603,7 +603,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(SpecificEntropy other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -663,8 +663,7 @@ public bool Equals(SpecificEntropy other, double tolerance, ComparisonType compa /// A hash code for the current SpecificEntropy. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs index 5f628e9789..fee6632b9c 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs @@ -513,7 +513,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(SpecificVolume other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -573,8 +573,7 @@ public bool Equals(SpecificVolume other, double tolerance, ComparisonType compar /// A hash code for the current SpecificVolume. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs index b16b20b835..ad1de65dc9 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs @@ -726,7 +726,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(SpecificWeight other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -786,8 +786,7 @@ public bool Equals(SpecificWeight other, double tolerance, ComparisonType compar /// A hash code for the current SpecificWeight. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Speed.g.cs b/UnitsNet/GeneratedCode/Quantities/Speed.g.cs index c737f029fc..b9383acd4d 100644 --- a/UnitsNet/GeneratedCode/Quantities/Speed.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Speed.g.cs @@ -948,7 +948,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Speed other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -1008,8 +1008,7 @@ public bool Equals(Speed other, double tolerance, ComparisonType comparisonType) /// A hash code for the current Speed. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs b/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs index 96be9d8dc7..5e8f68db75 100644 --- a/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs @@ -572,7 +572,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Temperature other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -632,8 +632,7 @@ public bool Equals(Temperature other, double tolerance, ComparisonType compariso /// A hash code for the current Temperature. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs index 43fe70651b..051498e615 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs @@ -618,7 +618,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(TemperatureChangeRate other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -678,8 +678,7 @@ public bool Equals(TemperatureChangeRate other, double tolerance, ComparisonType /// A hash code for the current TemperatureChangeRate. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs index d3b31a502f..f801b3848c 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs @@ -603,7 +603,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(TemperatureDelta other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -663,8 +663,7 @@ public bool Equals(TemperatureDelta other, double tolerance, ComparisonType comp /// A hash code for the current TemperatureDelta. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs index fb674a19fe..5f6041ca6f 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs @@ -501,7 +501,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ThermalConductivity other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -561,8 +561,7 @@ public bool Equals(ThermalConductivity other, double tolerance, ComparisonType c /// A hash code for the current ThermalConductivity. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs index 09b7c3fb70..36acc61b22 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs @@ -543,7 +543,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(ThermalResistance other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -603,8 +603,7 @@ public bool Equals(ThermalResistance other, double tolerance, ComparisonType com /// A hash code for the current ThermalResistance. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Torque.g.cs b/UnitsNet/GeneratedCode/Quantities/Torque.g.cs index e9facff0d9..2fcc1792b5 100644 --- a/UnitsNet/GeneratedCode/Quantities/Torque.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Torque.g.cs @@ -783,7 +783,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Torque other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -843,8 +843,7 @@ public bool Equals(Torque other, double tolerance, ComparisonType comparisonType /// A hash code for the current Torque. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/TorquePerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/TorquePerLength.g.cs index 89d71ca50e..9cb4e1e897 100644 --- a/UnitsNet/GeneratedCode/Quantities/TorquePerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TorquePerLength.g.cs @@ -783,7 +783,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(TorquePerLength other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -843,8 +843,7 @@ public bool Equals(TorquePerLength other, double tolerance, ComparisonType compa /// A hash code for the current TorquePerLength. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs b/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs index 76978c7472..9efaa31f44 100644 --- a/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs @@ -483,7 +483,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(VitaminA other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -543,8 +543,7 @@ public bool Equals(VitaminA other, double tolerance, ComparisonType comparisonTy /// A hash code for the current VitaminA. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/Volume.g.cs b/UnitsNet/GeneratedCode/Quantities/Volume.g.cs index d95e508b20..e29787c07e 100644 --- a/UnitsNet/GeneratedCode/Quantities/Volume.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Volume.g.cs @@ -1233,7 +1233,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(Volume other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -1293,8 +1293,7 @@ public bool Equals(Volume other, double tolerance, ComparisonType comparisonType /// A hash code for the current Volume. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs index a1a0faed11..a5fc510e21 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs @@ -771,7 +771,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(VolumeConcentration other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -831,8 +831,7 @@ public bool Equals(VolumeConcentration other, double tolerance, ComparisonType c /// A hash code for the current VolumeConcentration. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs index 2aa6ff9c41..1ea4c2ef66 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs @@ -1203,7 +1203,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(VolumeFlow other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -1263,8 +1263,7 @@ public bool Equals(VolumeFlow other, double tolerance, ComparisonType comparison /// A hash code for the current VolumeFlow. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs index 678edd0500..7bed23655e 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs @@ -573,7 +573,7 @@ public override bool Equals(object obj) /// Consider using for safely comparing floating point values. public bool Equals(VolumePerLength other) { - return CompareTo(other) == 0; + return _value.Equals(other.GetValueAs(this.Unit)); } /// @@ -633,8 +633,7 @@ public bool Equals(VolumePerLength other, double tolerance, ComparisonType compa /// A hash code for the current VolumePerLength. public override int GetHashCode() { - var roundedBaseValue = Math.Round(GetValueInBaseUnit(), 5); - return new { QuantityType, roundedBaseValue }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion From b2ba83fc32be4df69e3d5742dc9ef1432d4e649e Mon Sep 17 00:00:00 2001 From: lipchev Date: Sun, 7 Mar 2021 09:12:43 +0200 Subject: [PATCH 5/5] merged from upstream merging the recently generated entities --- .../TestsBase/TurbidityTestsBase.g.cs | 2 +- .../TestsBase/WarpingMomentOfInertiaTestsBase.g.cs | 2 +- UnitsNet/GeneratedCode/Quantities/Turbidity.g.cs | 14 ++++++++------ .../Quantities/WarpingMomentOfInertia.g.cs | 14 ++++++++------ 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/TurbidityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/TurbidityTestsBase.g.cs index c0a719c379..2c9305273d 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/TurbidityTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/TurbidityTestsBase.g.cs @@ -518,7 +518,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = Turbidity.FromNTU(1.0); - Assert.Equal(new {Turbidity.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(Turbidity.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/WarpingMomentOfInertiaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/WarpingMomentOfInertiaTestsBase.g.cs index e31cb57a48..ef01a371fe 100644 --- a/UnitsNet.Tests/GeneratedCode/TestsBase/WarpingMomentOfInertiaTestsBase.g.cs +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/WarpingMomentOfInertiaTestsBase.g.cs @@ -593,7 +593,7 @@ public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() public void GetHashCode_Equals() { var quantity = WarpingMomentOfInertia.FromMetersToTheSixth(1.0); - Assert.Equal(new {WarpingMomentOfInertia.QuantityType, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + Assert.Equal(WarpingMomentOfInertia.QuantityType.GetHashCode(), quantity.GetHashCode()); } [Theory] diff --git a/UnitsNet/GeneratedCode/Quantities/Turbidity.g.cs b/UnitsNet/GeneratedCode/Quantities/Turbidity.g.cs index a6cb383af6..fa004ec765 100644 --- a/UnitsNet/GeneratedCode/Quantities/Turbidity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Turbidity.g.cs @@ -420,25 +420,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Turbi /// Returns true if less or equal to. public static bool operator <=(Turbidity left, Turbidity right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(Turbidity left, Turbidity right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(Turbidity left, Turbidity right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(Turbidity left, Turbidity right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -467,7 +467,9 @@ public int CompareTo(object obj) /// public int CompareTo(Turbidity other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -544,7 +546,7 @@ public bool Equals(Turbidity other, double tolerance, ComparisonType comparisonT /// A hash code for the current Turbidity. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion diff --git a/UnitsNet/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs b/UnitsNet/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs index 645441b8de..caa9b14220 100644 --- a/UnitsNet/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs @@ -492,25 +492,25 @@ public static bool TryParseUnit(string str, IFormatProvider? provider, out Warpi /// Returns true if less or equal to. public static bool operator <=(WarpingMomentOfInertia left, WarpingMomentOfInertia right) { - return left.Value <= right.GetValueAs(left.Unit); + return left.CompareTo(right) <= 0; } /// Returns true if greater than or equal to. public static bool operator >=(WarpingMomentOfInertia left, WarpingMomentOfInertia right) { - return left.Value >= right.GetValueAs(left.Unit); + return left.CompareTo(right) >= 0; } /// Returns true if less than. public static bool operator <(WarpingMomentOfInertia left, WarpingMomentOfInertia right) { - return left.Value < right.GetValueAs(left.Unit); + return left.CompareTo(right) == -1; } /// Returns true if greater than. public static bool operator >(WarpingMomentOfInertia left, WarpingMomentOfInertia right) { - return left.Value > right.GetValueAs(left.Unit); + return left.CompareTo(right) == 1; } /// Returns true if exactly equal. @@ -539,7 +539,9 @@ public int CompareTo(object obj) /// public int CompareTo(WarpingMomentOfInertia other) { - return _value.CompareTo(other.GetValueAs(this.Unit)); + var asFirstUnit = other.GetValueAs(this.Unit); + var asSecondUnit = GetValueAs(other.Unit); + return (_value.CompareTo(asFirstUnit) - other.Value.CompareTo(asSecondUnit)) / 2; } /// @@ -616,7 +618,7 @@ public bool Equals(WarpingMomentOfInertia other, double tolerance, ComparisonTyp /// A hash code for the current WarpingMomentOfInertia. public override int GetHashCode() { - return new { QuantityType, Value, Unit }.GetHashCode(); + return QuantityType.GetHashCode(); } #endregion