Skip to content

Commit 9263c9e

Browse files
committed
♻️Rename to WithConversionFactorFrom/ToBase
1 parent 85356b4 commit 9263c9e

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

UnitsNet.Tests/CustomCode/QuantityInfos/Builder/QuantityInfoBuilderExtensionsTest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ public void Configure_UpdatesSpecificUnit()
4646
public void WithConversionFromBase_CreatesNewDefinition()
4747
{
4848
UnitDefinition<LengthUnit> oldDefinition = Length.LengthInfo.GetDefaultMappings().First();
49-
50-
UnitDefinition<LengthUnit> newDefinition = oldDefinition.WithConversionFromBase(20);
49+
50+
UnitDefinition<LengthUnit> newDefinition = oldDefinition.WithConversionFactorFromBase(20);
5151

5252
Assert.Equal(oldDefinition.Value, newDefinition.Value);
5353
Assert.Equal(oldDefinition.Name, newDefinition.Name);
@@ -62,7 +62,7 @@ public void WithConversionToBase_CreatesNewDefinition()
6262
{
6363
UnitInfo<Length, LengthUnit> oldDefinition = Length.Info.BaseUnitInfo;
6464

65-
UnitDefinition<LengthUnit> newDefinition = oldDefinition.WithConversionToBase(20);
65+
UnitDefinition<LengthUnit> newDefinition = oldDefinition.WithConversionFactorToBase(20);
6666

6767
Assert.Equal(oldDefinition.Value, newDefinition.Value);
6868
Assert.Equal(oldDefinition.Name, newDefinition.Name);

UnitsNet.Tests/UnitConverterTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ public void GetConversionFunction_WithCustomUnitConversion(bool freeze, Conversi
175175
bool reduceConstants)
176176
{
177177
var customLengthInfo = Length.LengthInfo.CreateDefault(unitDefinitions =>
178-
unitDefinitions.Configure(LengthUnit.Inch, definition => definition.WithConversionFromBase(18)));
178+
unitDefinitions.Configure(LengthUnit.Inch, definition => definition.WithConversionFactorFromBase(18)));
179179

180180
var unitParser = new UnitParser([customLengthInfo]);
181181
var convertOptions = new QuantityConverterBuildOptions(freeze, cachingMode, reduceConstants);
@@ -219,7 +219,7 @@ public void GetConversionFunction_WithCustomUnitConversion(bool freeze, Conversi
219219
public void TryGetConversionFunction_WithCustomUnitConversion_ReturnsTrue(bool freeze, ConversionCachingMode cachingMode, bool reduceConstants)
220220
{
221221
var customLengthInfo = Length.LengthInfo.CreateDefault(unitDefinitions =>
222-
unitDefinitions.Configure(LengthUnit.Inch, definition => definition.WithConversionFromBase(18)));
222+
unitDefinitions.Configure(LengthUnit.Inch, definition => definition.WithConversionFactorFromBase(18)));
223223

224224
var unitParser = new UnitParser([customLengthInfo]);
225225
var convertOptions = new QuantityConverterBuildOptions(freeze, cachingMode, reduceConstants);

UnitsNet/CustomCode/QuantityInfo/Builder/QuantityInfoBuilderExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public static IEnumerable<TUnitDefinition> Configure<TUnitDefinition, TUnit>(thi
7979
/// <param name="unitDefinition">The unit definition to which the conversion factor will be added.</param>
8080
/// <param name="conversionFromBase">The conversion factor from the base unit to the specified unit.</param>
8181
/// <returns>A new <see cref="UnitDefinition{TUnit}" /> instance with the specified conversion factor from the base unit.</returns>
82-
public static UnitDefinition<TUnit> WithConversionFromBase<TUnit>(this IUnitDefinition<TUnit> unitDefinition, QuantityValue conversionFromBase)
82+
public static UnitDefinition<TUnit> WithConversionFactorFromBase<TUnit>(this IUnitDefinition<TUnit> unitDefinition, QuantityValue conversionFromBase)
8383
where TUnit : struct, Enum
8484
{
8585
return new UnitDefinition<TUnit>(unitDefinition.Value, unitDefinition.Name, unitDefinition.PluralName, unitDefinition.BaseUnits, conversionFromBase);
@@ -92,7 +92,7 @@ public static UnitDefinition<TUnit> WithConversionFromBase<TUnit>(this IUnitDefi
9292
/// <param name="unitDefinition">The unit definition to which the conversion factor will be added.</param>
9393
/// <param name="conversionToBase">The conversion factor to the base unit from the specified unit.</param>
9494
/// <returns>A new <see cref="UnitDefinition{TUnit}" /> instance with the specified conversion factor to the base unit.</returns>
95-
public static UnitDefinition<TUnit> WithConversionToBase<TUnit>(this IUnitDefinition<TUnit> unitDefinition, QuantityValue conversionToBase)
95+
public static UnitDefinition<TUnit> WithConversionFactorToBase<TUnit>(this IUnitDefinition<TUnit> unitDefinition, QuantityValue conversionToBase)
9696
where TUnit : struct, Enum
9797
{
9898
return new UnitDefinition<TUnit>(unitDefinition.Value, unitDefinition.Name, unitDefinition.PluralName, unitDefinition.BaseUnits,

0 commit comments

Comments
 (0)