Skip to content

Commit 46663ea

Browse files
lipchevangularsen
andauthored
Remove SupportsSIUnitSystem => true property overrides (#1537)
Fixes #1463 --------- Co-authored-by: Andreas Gullberg Larsen <[email protected]>
1 parent 47435c0 commit 46663ea

File tree

117 files changed

+79
-212
lines changed

Some content is hidden

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

117 files changed

+79
-212
lines changed

UnitsNet.Tests/CustomCode/AbsorbedDoseOfIonizingRadiationTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ namespace UnitsNet.Tests.CustomCode
2424
public class AbsorbedDoseOfIonizingRadiationTests : AbsorbedDoseOfIonizingRadiationTestsBase
2525
{
2626
// Override properties in base class here
27-
protected override bool SupportsSIUnitSystem => true;
2827
protected override double CentigraysInOneGray => 100;
2928
protected override double FemtograysInOneGray => 1E+15;
3029
protected override double GigagraysInOneGray => 1E-9;

UnitsNet.Tests/CustomCode/AccelerationTests.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ namespace UnitsNet.Tests
77
{
88
public class AccelerationTests : AccelerationTestsBase
99
{
10-
protected override bool SupportsSIUnitSystem => true;
11-
1210
protected override double KilometersPerSecondSquaredInOneMeterPerSecondSquared => 1E-3;
1311

1412
protected override double MetersPerSecondSquaredInOneMeterPerSecondSquared => 1;

UnitsNet.Tests/CustomCode/AmountOfSubstanceTests.cs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ namespace UnitsNet.Tests.CustomCode
2828
{
2929
public class AmountOfSubstanceTests : AmountOfSubstanceTestsBase
3030
{
31-
protected override bool SupportsSIUnitSystem => true;
32-
3331
protected override double CentimolesInOneMole => 1e2;
3432
protected override double CentipoundMolesInOneMole => 0.002204622621848776 * 1e2;
3533
protected override double DecimolesInOneMole => 1e1;
@@ -71,9 +69,10 @@ public void NumberOfParticlesInTwoMolesIsDoubleAvogadroConstant()
7169
}
7270

7371
[Theory]
72+
// 10 Moles of Oxygen weight 10 times as much as 1 Mole of Oxygen (MolarMass)
7473
[InlineData(10, AmountOfSubstanceUnit.Mole,
75-
KnownQuantities.MolarMassOfOxygen, MolarMassUnit.GramPerMole,
76-
10 * KnownQuantities.MolarMassOfOxygen, MassUnit.Gram)] // 10 Moles of Oxygen weight 10 times as much as 1 Mole of Oxygen (MolarMass)
74+
KnownQuantities.MolarMassOfOxygen, MolarMassUnit.GramPerMole,
75+
10 * KnownQuantities.MolarMassOfOxygen, MassUnit.Gram)]
7776
public void MassFromAmountOfSubstanceAndMolarMass(
7877
double amountOfSubstanceValue, AmountOfSubstanceUnit amountOfSubstanceUnit,
7978
double molarMassValue, MolarMassUnit molarMassUnit,
@@ -88,10 +87,11 @@ public void MassFromAmountOfSubstanceAndMolarMass(
8887
}
8988

9089
[Theory]
90+
// molarity(HCl) = 5g / (1.2L * 36.46) = 0.114 mol/l = 0.114 M
9191
[InlineData(5, MassUnit.Gram,
92-
KnownQuantities.MolarMassHClInGramsPerMole, MolarMassUnit.GramPerMole,
93-
1.2, VolumeUnit.Liter,
94-
0.1142805, MolarityUnit.MolePerLiter)] // molarity(HCl) = 5g / (1.2L * 36.46) = 0.114 mol/l = 0.114 M
92+
KnownQuantities.MolarMassHClInGramsPerMole, MolarMassUnit.GramPerMole,
93+
1.2, VolumeUnit.Liter,
94+
0.1142805, MolarityUnit.MolePerLiter)]
9595
public void MolarityFromComponentMassAndSolutionVolume(
9696
double componentMassValue, MassUnit componentMassUnit,
9797
double componentMolarMassValue, MolarMassUnit componentMolarMassUnit,
@@ -109,10 +109,11 @@ public void MolarityFromComponentMassAndSolutionVolume(
109109
}
110110

111111
[Theory]
112+
// 1.2 L of solution required for obtaining 0.1142805 Moles/L from 5g HCl
112113
[InlineData(5, MassUnit.Gram,
113-
KnownQuantities.MolarMassHClInGramsPerMole, MolarMassUnit.GramPerMole,
114-
0.1142805, MolarityUnit.MolePerLiter,
115-
1.2, VolumeUnit.Liter)] // 1.2 L of solution required for obtaining 0.1142805 Moles/L from 5g HCl
114+
KnownQuantities.MolarMassHClInGramsPerMole, MolarMassUnit.GramPerMole,
115+
0.1142805, MolarityUnit.MolePerLiter,
116+
1.2, VolumeUnit.Liter)]
116117
public void VolumeSolutionFromComponentMassAndDesiredConcentration(
117118
double componentMassValue, MassUnit componentMassUnit,
118119
double componentMolarMassValue, MolarMassUnit componentMolarMassUnit,

UnitsNet.Tests/CustomCode/AmplitudeRatioTests.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ namespace UnitsNet.Tests
88
{
99
public class AmplitudeRatioTests : AmplitudeRatioTestsBase
1010
{
11-
protected override bool SupportsSIUnitSystem => false;
1211
protected override double DecibelMicrovoltsInOneDecibelVolt => 121;
1312

1413
protected override double DecibelMillivoltsInOneDecibelVolt => 61;
@@ -51,7 +50,7 @@ public void ExpectVoltageConvertedToAmplitudeRatioCorrectly(double voltage, doub
5150
// Amplitude ratio increases linearly by 20 dBV with power-of-10 increases of voltage.
5251
ElectricPotential v = ElectricPotential.FromVolts(voltage);
5352

54-
double actual = AmplitudeRatio.FromElectricPotential(v).DecibelVolts;
53+
var actual = AmplitudeRatio.FromElectricPotential(v).DecibelVolts;
5554
Assert.Equal(expected, actual);
5655
}
5756

@@ -65,8 +64,8 @@ public void ExpectAmplitudeRatioConvertedToVoltageCorrectly(double amplitudeRati
6564
{
6665
// Voltage increases by powers of 10 for every 20 dBV increase in amplitude ratio.
6766
AmplitudeRatio ar = AmplitudeRatio.FromDecibelVolts(amplitudeRatio);
68-
69-
double actual = ar.ToElectricPotential().Volts;
67+
68+
var actual = ar.ToElectricPotential().Volts;
7069
Assert.Equal(expected, actual);
7170
}
7271

@@ -80,8 +79,8 @@ public void ExpectAmplitudeRatioConvertedToVoltageCorrectly(double amplitudeRati
8079
public void AmplitudeRatioToPowerRatio_50OhmImpedance(double dBmV, double expected)
8180
{
8281
AmplitudeRatio ampRatio = AmplitudeRatio.FromDecibelMillivolts(dBmV);
83-
84-
double actual = Math.Round(ampRatio.ToPowerRatio(ElectricResistance.FromOhms(50)).DecibelMilliwatts, 2);
82+
83+
var actual = Math.Round(ampRatio.ToPowerRatio(ElectricResistance.FromOhms(50)).DecibelMilliwatts, 2);
8584
Assert.Equal(expected, actual);
8685
}
8786

@@ -93,8 +92,8 @@ public void AmplitudeRatioToPowerRatio_50OhmImpedance(double dBmV, double expect
9392
public void AmplitudeRatioToPowerRatio_75OhmImpedance(double dBmV, double expected)
9493
{
9594
AmplitudeRatio ampRatio = AmplitudeRatio.FromDecibelMillivolts(dBmV);
96-
97-
double actual = Math.Round(ampRatio.ToPowerRatio(ElectricResistance.FromOhms(75)).DecibelMilliwatts, 2);
95+
96+
var actual = Math.Round(ampRatio.ToPowerRatio(ElectricResistance.FromOhms(75)).DecibelMilliwatts, 2);
9897
Assert.Equal(expected, actual);
9998
}
10099
}

UnitsNet.Tests/CustomCode/AngleTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ namespace UnitsNet.Tests
88
{
99
public class AngleTests : AngleTestsBase
1010
{
11-
protected override bool SupportsSIUnitSystem => false;
1211
protected override double RadiansInOneRadian => 1;
1312
protected override double DeciradiansInOneRadian => 1E1;
1413
protected override double CentiradiansInOneRadian => 1E2;

UnitsNet.Tests/CustomCode/AreaDensityTests.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ namespace UnitsNet.Tests.CustomCode
2828
{
2929
public class AreaDensityTests : AreaDensityTestsBase
3030
{
31-
protected override bool SupportsSIUnitSystem => true;
32-
3331
protected override double GramsPerSquareMeterInOneKilogramPerSquareMeter => 1000;
3432

3533
protected override double KilogramsPerSquareMeterInOneKilogramPerSquareMeter => 1;

UnitsNet.Tests/CustomCode/AreaMomentOfInertiaTests.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ namespace UnitsNet.Tests.CustomCode
2828
{
2929
public class AreaMomentOfInertiaTests : AreaMomentOfInertiaTestsBase
3030
{
31-
protected override bool SupportsSIUnitSystem => true;
32-
3331
protected override double CentimetersToTheFourthInOneMeterToTheFourth => 1e8;
3432

3533
protected override double DecimetersToTheFourthInOneMeterToTheFourth => 1e4;

UnitsNet.Tests/CustomCode/AreaTests.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ namespace UnitsNet.Tests
88
{
99
public class AreaTests : AreaTestsBase
1010
{
11-
protected override bool SupportsSIUnitSystem => true;
12-
1311
protected override double SquareKilometersInOneSquareMeter => 1E-6;
1412

1513
protected override double SquareMetersInOneSquareMeter => 1;
@@ -71,7 +69,7 @@ public void AreaTimesDensityEqualsLinearDensity()
7169
[InlineData(0.5, 0.19634954084936208)]
7270
[InlineData(1, 0.7853981633974483)]
7371
[InlineData(2, 3.141592653589793)]
74-
public void AreaFromCicleDiameterCalculatedCorrectly(double diameterMeters, double expected)
72+
public void AreaFromCircleDiameterCalculatedCorrectly(double diameterMeters, double expected)
7573
{
7674
Length diameter = Length.FromMeters(diameterMeters);
7775

@@ -85,7 +83,7 @@ public void AreaFromCicleDiameterCalculatedCorrectly(double diameterMeters, doub
8583
[InlineData(0.5, 0.7853981633974483)]
8684
[InlineData(1, 3.141592653589793)]
8785
[InlineData(2, 12.566370614359173)]
88-
public void AreaFromCicleRadiusCalculatedCorrectly(double radiusMeters, double expected)
86+
public void AreaFromCircleRadiusCalculatedCorrectly(double radiusMeters, double expected)
8987
{
9088
Length radius = Length.FromMeters(radiusMeters);
9189

UnitsNet.Tests/CustomCode/BitRateTests.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ namespace UnitsNet.Tests.CustomCode
2727
{
2828
public class BitRateTests : BitRateTestsBase
2929
{
30-
protected override bool SupportsSIUnitSystem => false;
31-
3230
protected override double BitsPerSecondInOneBitPerSecond => 1;
3331
protected override double BytesPerSecondInOneBitPerSecond => 1.25E-1;
3432

UnitsNet.Tests/CustomCode/BrakeSpecificFuelConsumptionTests.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ namespace UnitsNet.Tests
88
{
99
public class BrakeSpecificFuelConsumptionTests : BrakeSpecificFuelConsumptionTestsBase
1010
{
11-
protected override bool SupportsSIUnitSystem => false;
12-
1311
protected override double GramsPerKiloWattHourInOneKilogramPerJoule => 3600000000;
1412

1513
protected override double KilogramsPerJouleInOneKilogramPerJoule => 1.0;
@@ -26,15 +24,15 @@ public void PowerTimesBrakeSpecificFuelConsumptionEqualsMassFlow()
2624
[Fact]
2725
public void DoubleDividedByBrakeSpecificFuelConsumptionEqualsSpecificEnergy()
2826
{
29-
SpecificEnergy massFlow = 2.0 / BrakeSpecificFuelConsumption.FromKilogramsPerJoule(4.0);
27+
SpecificEnergy massFlow = 2 / BrakeSpecificFuelConsumption.FromKilogramsPerJoule(4);
3028
Assert.Equal(SpecificEnergy.FromJoulesPerKilogram(0.5), massFlow);
3129
}
3230

3331
[Fact]
3432
public void BrakeSpecificFuelConsumptionTimesSpecificEnergyEqualsEnergy()
3533
{
36-
double value = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(20.0) * SpecificEnergy.FromJoulesPerKilogram(10.0);
37-
Assert.Equal(200.0, value);
34+
var value = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(20) * SpecificEnergy.FromJoulesPerKilogram(10);
35+
Assert.Equal(200, value);
3836
}
3937
}
4038
}

0 commit comments

Comments
 (0)