diff --git a/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs b/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs
index bbde37cc6b..dfaa53af3d 100644
--- a/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs
+++ b/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs
@@ -1151,9 +1151,6 @@ IQuantity IQuantity.ToUnit(Enum unit)
///
IQuantity<{_unitEnumName}> IQuantity<{_unitEnumName}>.ToUnit({_unitEnumName} unit) => ToUnit(unit);
- ///
- IQuantity<{_unitEnumName}> IQuantity<{_unitEnumName}>.ToUnit(UnitSystem unitSystem) => this.ToUnit(unitSystem);
-
#endregion
#endregion
diff --git a/CodeGen/Generators/UnitsNetGen/UnitTestBaseClassGenerator.cs b/CodeGen/Generators/UnitsNetGen/UnitTestBaseClassGenerator.cs
index b2ebbdf0b3..a5818b07cf 100644
--- a/CodeGen/Generators/UnitsNetGen/UnitTestBaseClassGenerator.cs
+++ b/CodeGen/Generators/UnitsNetGen/UnitTestBaseClassGenerator.cs
@@ -412,37 +412,14 @@ public void As_UnitSystem_ThrowsArgumentNullExceptionIfNull()
[Fact]
public void ToUnit_UnitSystem_ReturnsValueInDimensionlessUnit()
{{
- Assert.Multiple(() =>
- {{
- var quantity = new {_quantity.Name}(value: 1, unit: {_baseUnitFullName});
-
- {_quantity.Name} convertedQuantity = quantity.ToUnit(UnitSystem.SI);
-
- Assert.Equal({_baseUnitFullName}, convertedQuantity.Unit);
- Assert.Equal(quantity.Value, convertedQuantity.Value);
- }}, () =>
- {{
- IQuantity<{_unitEnumName}> quantity = new {_quantity.Name}(value: 1, unit: {_baseUnitFullName});
-
- IQuantity<{_unitEnumName}> convertedQuantity = quantity.ToUnit(UnitSystem.SI);
-
- Assert.Equal({_baseUnitFullName}, convertedQuantity.Unit);
- Assert.Equal(quantity.Value, convertedQuantity.Value);
- }});
- }}
-
- [Fact]
- public void ToUnitUntyped_UnitSystem_ReturnsValueInDimensionlessUnit()
- {{
- IQuantity quantity = new {_quantity.Name}(value: 1, unit: {_baseUnitFullName});
+ var quantity = new {_quantity.Name}(value: 1, unit: {_baseUnitFullName});
- IQuantity convertedQuantity = quantity.ToUnitUntyped(UnitSystem.SI);
+ {_quantity.Name} convertedQuantity = quantity.ToUnit(UnitSystem.SI);
Assert.Equal({_baseUnitFullName}, convertedQuantity.Unit);
Assert.Equal(quantity.Value, convertedQuantity.Value);
}}
-
[Fact]
public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull()
{{
@@ -450,15 +427,15 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull()
Assert.Multiple(() =>
{{
var quantity = new {_quantity.Name}(value: 1, unit: {_quantity.Name}.BaseUnit);
- Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem));
+ Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
}}, () =>
{{
IQuantity<{_unitEnumName}> quantity = new {_quantity.Name}(value: 1, unit: {_quantity.Name}.BaseUnit);
- Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem));
+ Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
}}, () =>
{{
IQuantity quantity = new {_quantity.Name}(value: 1, unit: {_quantity.Name}.BaseUnit);
- Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem));
+ Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
}});
}}
");
@@ -508,35 +485,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits()
var expectedUnit = {_quantity.Name}.Info.GetDefaultUnit(UnitSystem.SI);
var expectedValue = quantity.As(expectedUnit);
- Assert.Multiple(() =>
- {{
- {_quantity.Name} quantityToConvert = quantity;
-
- {_quantity.Name} convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI);
-
- Assert.Equal(expectedUnit, convertedQuantity.Unit);
- Assert.Equal(expectedValue, convertedQuantity.Value);
- }}, () =>
- {{
- IQuantity<{_unitEnumName}> quantityToConvert = quantity;
-
- IQuantity<{_unitEnumName}> convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI);
-
- Assert.Equal(expectedUnit, convertedQuantity.Unit);
- Assert.Equal(expectedValue, convertedQuantity.Value);
- }});
- }}
-
- [Fact]
- public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits()
- {{
- var quantity = new {_quantity.Name}(value: 1, unit: {_quantity.Name}.BaseUnit);
- var expectedUnit = {_quantity.Name}.Info.GetDefaultUnit(UnitSystem.SI);
- var expectedValue = quantity.As(expectedUnit);
-
- IQuantity quantityToConvert = quantity;
-
- IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI);
+ {_quantity.Name} convertedQuantity = quantity.ToUnit(UnitSystem.SI);
Assert.Equal(expectedUnit, convertedQuantity.Unit);
Assert.Equal(expectedValue, convertedQuantity.Value);
@@ -546,46 +495,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits()
public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull()
{{
UnitSystem nullUnitSystem = null!;
- Assert.Multiple(() =>
- {{
- var quantity = new {_quantity.Name}(value: 1, unit: {_quantity.Name}.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
- }}, () =>
- {{
- IQuantity<{_unitEnumName}> quantity = new {_quantity.Name}(value: 1, unit: {_quantity.Name}.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
- }});
- }}
-
- [Fact]
- public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull()
- {{
- UnitSystem nullUnitSystem = null!;
- IQuantity quantity = new {_quantity.Name}(value: 1, unit: {_quantity.Name}.BaseUnit);
- Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem));
+ var quantity = new {_quantity.Name}(value: 1, unit: {_quantity.Name}.BaseUnit);
+ Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
}}
[Fact]
public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported()
{{
var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits);
- Assert.Multiple(() =>
- {{
- var quantity = new {_quantity.Name}(value: 1, unit: {_quantity.Name}.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
- }}, () =>
- {{
- IQuantity<{_unitEnumName}> quantity = new {_quantity.Name}(value: 1, unit: {_quantity.Name}.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
- }});
- }}
-
- [Fact]
- public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported()
- {{
- var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits);
- IQuantity quantity = new {_quantity.Name}(value: 1, unit: {_quantity.Name}.BaseUnit);
- Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem));
+ var quantity = new {_quantity.Name}(value: 1, unit: {_quantity.Name}.BaseUnit);
+ Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
}}
");
}
diff --git a/UnitsNet.Tests/CustomCode/ElectricApparentEnergyTests.cs b/UnitsNet.Tests/CustomCode/ElectricApparentEnergyTests.cs
index 0e03d7c445..33e85f4386 100644
--- a/UnitsNet.Tests/CustomCode/ElectricApparentEnergyTests.cs
+++ b/UnitsNet.Tests/CustomCode/ElectricApparentEnergyTests.cs
@@ -55,11 +55,5 @@ public override void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits()
{
base.ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits();
}
-
- [Fact(Skip = "See about adding an SI unit (VoltampereSecond, Joules?)")]
- public override void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits()
- {
- base.ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits();
- }
}
}
diff --git a/UnitsNet.Tests/CustomCode/ElectricReactiveEnergyTests.cs b/UnitsNet.Tests/CustomCode/ElectricReactiveEnergyTests.cs
index c6a879999c..f1a56b6811 100644
--- a/UnitsNet.Tests/CustomCode/ElectricReactiveEnergyTests.cs
+++ b/UnitsNet.Tests/CustomCode/ElectricReactiveEnergyTests.cs
@@ -54,11 +54,5 @@ public override void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits()
{
base.ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits();
}
-
- [Fact(Skip = "See about adding an SI unit (VoltampereReactiveSecond, Joules?)")]
- public override void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits()
- {
- base.ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits();
- }
}
}
diff --git a/UnitsNet.Tests/CustomCode/FuelEfficiencyTests.cs b/UnitsNet.Tests/CustomCode/FuelEfficiencyTests.cs
index 06bf5627cb..3e6e249af0 100644
--- a/UnitsNet.Tests/CustomCode/FuelEfficiencyTests.cs
+++ b/UnitsNet.Tests/CustomCode/FuelEfficiencyTests.cs
@@ -54,11 +54,5 @@ public override void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits()
{
base.ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits();
}
-
- [Fact(Skip = "The SI unit would have to be MeterPerCubicMeter")]
- public override void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits()
- {
- base.ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits();
- }
}
}
diff --git a/UnitsNet.Tests/CustomCode/IQuantityTests.cs b/UnitsNet.Tests/CustomCode/IQuantityTests.cs
index 012f0cc09f..ce591ef0aa 100644
--- a/UnitsNet.Tests/CustomCode/IQuantityTests.cs
+++ b/UnitsNet.Tests/CustomCode/IQuantityTests.cs
@@ -1,31 +1,84 @@
// Licensed under MIT No Attribution, see LICENSE file at the root.
// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet.
-using System;
-using System.Linq;
-using Xunit;
+namespace UnitsNet.Tests;
-namespace UnitsNet.Tests
+// ReSharper disable once InconsistentNaming
+public partial class IQuantityTests
{
- // ReSharper disable once InconsistentNaming
- public partial class IQuantityTests
+ [Fact]
+ public void As_GivenWrongUnitType_ThrowsArgumentException()
{
- [Fact]
- public void As_GivenWrongUnitType_ThrowsArgumentException()
+ Assert.All(Quantity.Infos.Select(x => x.Zero), quantity => { Assert.Throws(() => quantity.As(ComparisonType.Absolute)); });
+ }
+
+ [Fact]
+ public void ToUnit_GivenWrongUnitType_ThrowsArgumentException()
+ {
+ Assert.All(Quantity.Infos.Select(x => x.Zero), quantity => { Assert.Throws(() => quantity.ToUnit(ComparisonType.Absolute)); });
+ }
+
+ [Fact]
+ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits()
+ {
+ var quantity = new Mass(1, Mass.BaseUnit);
+ MassUnit expectedUnit = Mass.Info.GetDefaultUnit(UnitSystem.SI);
+ var expectedValue = quantity.As(expectedUnit);
+
+ Assert.Multiple(() =>
+ {
+ IQuantity quantityToConvert = quantity;
+
+ IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI);
+
+ Assert.Equal(expectedUnit, convertedQuantity.Unit);
+ Assert.Equal(expectedValue, convertedQuantity.Value);
+ }, () =>
+ {
+ IQuantity quantityToConvert = quantity;
+
+ IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI);
+
+ Assert.Equal(expectedUnit, convertedQuantity.Unit);
+ Assert.Equal(expectedValue, convertedQuantity.Value);
+ });
+ }
+
+ [Fact]
+ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull()
+ {
+ UnitSystem nullUnitSystem = null!;
+ Assert.Multiple(() =>
+ {
+ IQuantity quantity = new Mass(1, Mass.BaseUnit);
+ Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
+ }, () =>
+ {
+ IQuantity quantity = new Mass(1, Mass.BaseUnit);
+ Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
+ });
+ }
+
+ [Fact]
+ public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported()
+ {
+ var unsupportedUnitSystem = new UnitSystem(new BaseUnits(
+ (LengthUnit)(-1),
+ (MassUnit)(-1),
+ (DurationUnit)(-1),
+ (ElectricCurrentUnit)(-1),
+ (TemperatureUnit)(-1),
+ (AmountOfSubstanceUnit)(-1),
+ (LuminousIntensityUnit)(-1)));
+
+ Assert.Multiple(() =>
{
- Assert.All(Quantity.Infos.Select(x => x.Zero), quantity =>
- {
- Assert.Throws(() => quantity.As(ComparisonType.Absolute));
- });
- }
-
- [Fact]
- public void ToUnit_GivenWrongUnitType_ThrowsArgumentException()
+ IQuantity quantity = new Mass(1, Mass.BaseUnit);
+ Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
+ }, () =>
{
- Assert.All(Quantity.Infos.Select(x => x.Zero), quantity =>
- {
- Assert.Throws(() => quantity.ToUnit(ComparisonType.Absolute));
- });
- }
+ IQuantity quantity = new Mass(1, Mass.BaseUnit);
+ Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
+ });
}
}
diff --git a/UnitsNet.Tests/CustomQuantities/HowMuch.cs b/UnitsNet.Tests/CustomQuantities/HowMuch.cs
index 80db2ffff6..7a59f20a8d 100644
--- a/UnitsNet.Tests/CustomQuantities/HowMuch.cs
+++ b/UnitsNet.Tests/CustomQuantities/HowMuch.cs
@@ -70,8 +70,6 @@ public double As(UnitKey unitKey)
return As(unitKey.ToUnit());
}
- public double As(UnitSystem unitSystem) => throw new NotImplementedException();
-
public IQuantity ToUnit(Enum unit)
{
if (unit is HowMuchUnit howMuchUnit) return new HowMuch(As(unit), howMuchUnit);
@@ -82,13 +80,6 @@ public IQuantity ToUnit(HowMuchUnit unit)
{
throw new NotImplementedException();
}
-
- IQuantity IQuantity.ToUnit(UnitSystem unitSystem)
- {
- throw new NotImplementedException();
- }
-
- public IQuantity ToUnit(UnitSystem unitSystem) => throw new NotImplementedException();
public override string ToString()
{
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AbsorbedDoseOfIonizingRadiationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AbsorbedDoseOfIonizingRadiationTestsBase.g.cs
index 1468b9c0bc..8840d0d429 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/AbsorbedDoseOfIonizingRadiationTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AbsorbedDoseOfIonizingRadiationTestsBase.g.cs
@@ -305,35 +305,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits()
var expectedUnit = AbsorbedDoseOfIonizingRadiation.Info.GetDefaultUnit(UnitSystem.SI);
var expectedValue = quantity.As(expectedUnit);
- Assert.Multiple(() =>
- {
- AbsorbedDoseOfIonizingRadiation quantityToConvert = quantity;
-
- AbsorbedDoseOfIonizingRadiation convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI);
-
- Assert.Equal(expectedUnit, convertedQuantity.Unit);
- Assert.Equal(expectedValue, convertedQuantity.Value);
- }, () =>
- {
- IQuantity quantityToConvert = quantity;
-
- IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI);
-
- Assert.Equal(expectedUnit, convertedQuantity.Unit);
- Assert.Equal(expectedValue, convertedQuantity.Value);
- });
- }
-
- [Fact]
- public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits()
- {
- var quantity = new AbsorbedDoseOfIonizingRadiation(value: 1, unit: AbsorbedDoseOfIonizingRadiation.BaseUnit);
- var expectedUnit = AbsorbedDoseOfIonizingRadiation.Info.GetDefaultUnit(UnitSystem.SI);
- var expectedValue = quantity.As(expectedUnit);
-
- IQuantity quantityToConvert = quantity;
-
- IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI);
+ AbsorbedDoseOfIonizingRadiation convertedQuantity = quantity.ToUnit(UnitSystem.SI);
Assert.Equal(expectedUnit, convertedQuantity.Unit);
Assert.Equal(expectedValue, convertedQuantity.Value);
@@ -343,46 +315,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits()
public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull()
{
UnitSystem nullUnitSystem = null!;
- Assert.Multiple(() =>
- {
- var quantity = new AbsorbedDoseOfIonizingRadiation(value: 1, unit: AbsorbedDoseOfIonizingRadiation.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
- }, () =>
- {
- IQuantity quantity = new AbsorbedDoseOfIonizingRadiation(value: 1, unit: AbsorbedDoseOfIonizingRadiation.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
- });
- }
-
- [Fact]
- public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull()
- {
- UnitSystem nullUnitSystem = null!;
- IQuantity quantity = new AbsorbedDoseOfIonizingRadiation(value: 1, unit: AbsorbedDoseOfIonizingRadiation.BaseUnit);
- Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem));
+ var quantity = new AbsorbedDoseOfIonizingRadiation(value: 1, unit: AbsorbedDoseOfIonizingRadiation.BaseUnit);
+ Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
}
[Fact]
public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported()
{
var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits);
- Assert.Multiple(() =>
- {
- var quantity = new AbsorbedDoseOfIonizingRadiation(value: 1, unit: AbsorbedDoseOfIonizingRadiation.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
- }, () =>
- {
- IQuantity quantity = new AbsorbedDoseOfIonizingRadiation(value: 1, unit: AbsorbedDoseOfIonizingRadiation.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
- });
- }
-
- [Fact]
- public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported()
- {
- var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits);
- IQuantity quantity = new AbsorbedDoseOfIonizingRadiation(value: 1, unit: AbsorbedDoseOfIonizingRadiation.BaseUnit);
- Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem));
+ var quantity = new AbsorbedDoseOfIonizingRadiation(value: 1, unit: AbsorbedDoseOfIonizingRadiation.BaseUnit);
+ Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
}
[Theory]
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AccelerationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AccelerationTestsBase.g.cs
index df6b31005e..c9600ef2ed 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/AccelerationTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AccelerationTestsBase.g.cs
@@ -287,35 +287,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits()
var expectedUnit = Acceleration.Info.GetDefaultUnit(UnitSystem.SI);
var expectedValue = quantity.As(expectedUnit);
- Assert.Multiple(() =>
- {
- Acceleration quantityToConvert = quantity;
-
- Acceleration convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI);
-
- Assert.Equal(expectedUnit, convertedQuantity.Unit);
- Assert.Equal(expectedValue, convertedQuantity.Value);
- }, () =>
- {
- IQuantity quantityToConvert = quantity;
-
- IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI);
-
- Assert.Equal(expectedUnit, convertedQuantity.Unit);
- Assert.Equal(expectedValue, convertedQuantity.Value);
- });
- }
-
- [Fact]
- public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits()
- {
- var quantity = new Acceleration(value: 1, unit: Acceleration.BaseUnit);
- var expectedUnit = Acceleration.Info.GetDefaultUnit(UnitSystem.SI);
- var expectedValue = quantity.As(expectedUnit);
-
- IQuantity quantityToConvert = quantity;
-
- IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI);
+ Acceleration convertedQuantity = quantity.ToUnit(UnitSystem.SI);
Assert.Equal(expectedUnit, convertedQuantity.Unit);
Assert.Equal(expectedValue, convertedQuantity.Value);
@@ -325,46 +297,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits()
public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull()
{
UnitSystem nullUnitSystem = null!;
- Assert.Multiple(() =>
- {
- var quantity = new Acceleration(value: 1, unit: Acceleration.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
- }, () =>
- {
- IQuantity quantity = new Acceleration(value: 1, unit: Acceleration.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
- });
- }
-
- [Fact]
- public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull()
- {
- UnitSystem nullUnitSystem = null!;
- IQuantity quantity = new Acceleration(value: 1, unit: Acceleration.BaseUnit);
- Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem));
+ var quantity = new Acceleration(value: 1, unit: Acceleration.BaseUnit);
+ Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
}
[Fact]
public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported()
{
var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits);
- Assert.Multiple(() =>
- {
- var quantity = new Acceleration(value: 1, unit: Acceleration.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
- }, () =>
- {
- IQuantity quantity = new Acceleration(value: 1, unit: Acceleration.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
- });
- }
-
- [Fact]
- public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported()
- {
- var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits);
- IQuantity quantity = new Acceleration(value: 1, unit: Acceleration.BaseUnit);
- Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem));
+ var quantity = new Acceleration(value: 1, unit: Acceleration.BaseUnit);
+ Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
}
[Theory]
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AmountOfSubstanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AmountOfSubstanceTestsBase.g.cs
index f83c68a30b..a18ed6b913 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/AmountOfSubstanceTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AmountOfSubstanceTestsBase.g.cs
@@ -305,35 +305,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits()
var expectedUnit = AmountOfSubstance.Info.GetDefaultUnit(UnitSystem.SI);
var expectedValue = quantity.As(expectedUnit);
- Assert.Multiple(() =>
- {
- AmountOfSubstance quantityToConvert = quantity;
-
- AmountOfSubstance convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI);
-
- Assert.Equal(expectedUnit, convertedQuantity.Unit);
- Assert.Equal(expectedValue, convertedQuantity.Value);
- }, () =>
- {
- IQuantity quantityToConvert = quantity;
-
- IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI);
-
- Assert.Equal(expectedUnit, convertedQuantity.Unit);
- Assert.Equal(expectedValue, convertedQuantity.Value);
- });
- }
-
- [Fact]
- public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits()
- {
- var quantity = new AmountOfSubstance(value: 1, unit: AmountOfSubstance.BaseUnit);
- var expectedUnit = AmountOfSubstance.Info.GetDefaultUnit(UnitSystem.SI);
- var expectedValue = quantity.As(expectedUnit);
-
- IQuantity quantityToConvert = quantity;
-
- IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI);
+ AmountOfSubstance convertedQuantity = quantity.ToUnit(UnitSystem.SI);
Assert.Equal(expectedUnit, convertedQuantity.Unit);
Assert.Equal(expectedValue, convertedQuantity.Value);
@@ -343,46 +315,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits()
public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull()
{
UnitSystem nullUnitSystem = null!;
- Assert.Multiple(() =>
- {
- var quantity = new AmountOfSubstance(value: 1, unit: AmountOfSubstance.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
- }, () =>
- {
- IQuantity quantity = new AmountOfSubstance(value: 1, unit: AmountOfSubstance.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
- });
- }
-
- [Fact]
- public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull()
- {
- UnitSystem nullUnitSystem = null!;
- IQuantity quantity = new AmountOfSubstance(value: 1, unit: AmountOfSubstance.BaseUnit);
- Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem));
+ var quantity = new AmountOfSubstance(value: 1, unit: AmountOfSubstance.BaseUnit);
+ Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
}
[Fact]
public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported()
{
var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits);
- Assert.Multiple(() =>
- {
- var quantity = new AmountOfSubstance(value: 1, unit: AmountOfSubstance.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
- }, () =>
- {
- IQuantity quantity = new AmountOfSubstance(value: 1, unit: AmountOfSubstance.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
- });
- }
-
- [Fact]
- public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported()
- {
- var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits);
- IQuantity quantity = new AmountOfSubstance(value: 1, unit: AmountOfSubstance.BaseUnit);
- Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem));
+ var quantity = new AmountOfSubstance(value: 1, unit: AmountOfSubstance.BaseUnit);
+ Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
}
[Theory]
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AmplitudeRatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AmplitudeRatioTestsBase.g.cs
index 3b46e2b40b..f59245efa9 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/AmplitudeRatioTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AmplitudeRatioTestsBase.g.cs
@@ -186,37 +186,14 @@ public void As_UnitSystem_ThrowsArgumentNullExceptionIfNull()
[Fact]
public void ToUnit_UnitSystem_ReturnsValueInDimensionlessUnit()
{
- Assert.Multiple(() =>
- {
- var quantity = new AmplitudeRatio(value: 1, unit: AmplitudeRatioUnit.DecibelVolt);
-
- AmplitudeRatio convertedQuantity = quantity.ToUnit(UnitSystem.SI);
-
- Assert.Equal(AmplitudeRatioUnit.DecibelVolt, convertedQuantity.Unit);
- Assert.Equal(quantity.Value, convertedQuantity.Value);
- }, () =>
- {
- IQuantity quantity = new AmplitudeRatio(value: 1, unit: AmplitudeRatioUnit.DecibelVolt);
-
- IQuantity convertedQuantity = quantity.ToUnit(UnitSystem.SI);
-
- Assert.Equal(AmplitudeRatioUnit.DecibelVolt, convertedQuantity.Unit);
- Assert.Equal(quantity.Value, convertedQuantity.Value);
- });
- }
-
- [Fact]
- public void ToUnitUntyped_UnitSystem_ReturnsValueInDimensionlessUnit()
- {
- IQuantity quantity = new AmplitudeRatio(value: 1, unit: AmplitudeRatioUnit.DecibelVolt);
+ var quantity = new AmplitudeRatio(value: 1, unit: AmplitudeRatioUnit.DecibelVolt);
- IQuantity convertedQuantity = quantity.ToUnitUntyped(UnitSystem.SI);
+ AmplitudeRatio convertedQuantity = quantity.ToUnit(UnitSystem.SI);
Assert.Equal(AmplitudeRatioUnit.DecibelVolt, convertedQuantity.Unit);
Assert.Equal(quantity.Value, convertedQuantity.Value);
}
-
[Fact]
public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull()
{
@@ -224,15 +201,15 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull()
Assert.Multiple(() =>
{
var quantity = new AmplitudeRatio(value: 1, unit: AmplitudeRatio.BaseUnit);
- Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem));
+ Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
}, () =>
{
IQuantity quantity = new AmplitudeRatio(value: 1, unit: AmplitudeRatio.BaseUnit);
- Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem));
+ Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
}, () =>
{
IQuantity quantity = new AmplitudeRatio(value: 1, unit: AmplitudeRatio.BaseUnit);
- Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem));
+ Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
});
}
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AngleTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AngleTestsBase.g.cs
index 213bdd8424..b9fc738a7f 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/AngleTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AngleTestsBase.g.cs
@@ -252,37 +252,14 @@ public void As_UnitSystem_ThrowsArgumentNullExceptionIfNull()
[Fact]
public void ToUnit_UnitSystem_ReturnsValueInDimensionlessUnit()
{
- Assert.Multiple(() =>
- {
- var quantity = new Angle(value: 1, unit: AngleUnit.Radian);
-
- Angle convertedQuantity = quantity.ToUnit(UnitSystem.SI);
-
- Assert.Equal(AngleUnit.Radian, convertedQuantity.Unit);
- Assert.Equal(quantity.Value, convertedQuantity.Value);
- }, () =>
- {
- IQuantity quantity = new Angle(value: 1, unit: AngleUnit.Radian);
-
- IQuantity convertedQuantity = quantity.ToUnit(UnitSystem.SI);
-
- Assert.Equal(AngleUnit.Radian, convertedQuantity.Unit);
- Assert.Equal(quantity.Value, convertedQuantity.Value);
- });
- }
-
- [Fact]
- public void ToUnitUntyped_UnitSystem_ReturnsValueInDimensionlessUnit()
- {
- IQuantity quantity = new Angle(value: 1, unit: AngleUnit.Radian);
+ var quantity = new Angle(value: 1, unit: AngleUnit.Radian);
- IQuantity convertedQuantity = quantity.ToUnitUntyped(UnitSystem.SI);
+ Angle convertedQuantity = quantity.ToUnit(UnitSystem.SI);
Assert.Equal(AngleUnit.Radian, convertedQuantity.Unit);
Assert.Equal(quantity.Value, convertedQuantity.Value);
}
-
[Fact]
public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull()
{
@@ -290,15 +267,15 @@ public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull()
Assert.Multiple(() =>
{
var quantity = new Angle(value: 1, unit: Angle.BaseUnit);
- Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem));
+ Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
}, () =>
{
IQuantity quantity = new Angle(value: 1, unit: Angle.BaseUnit);
- Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem));
+ Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
}, () =>
{
IQuantity quantity = new Angle(value: 1, unit: Angle.BaseUnit);
- Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem));
+ Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
});
}
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AreaDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AreaDensityTestsBase.g.cs
index 6da629fbf6..9389bf8362 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/AreaDensityTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AreaDensityTestsBase.g.cs
@@ -221,35 +221,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits()
var expectedUnit = AreaDensity.Info.GetDefaultUnit(UnitSystem.SI);
var expectedValue = quantity.As(expectedUnit);
- Assert.Multiple(() =>
- {
- AreaDensity quantityToConvert = quantity;
-
- AreaDensity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI);
-
- Assert.Equal(expectedUnit, convertedQuantity.Unit);
- Assert.Equal(expectedValue, convertedQuantity.Value);
- }, () =>
- {
- IQuantity quantityToConvert = quantity;
-
- IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI);
-
- Assert.Equal(expectedUnit, convertedQuantity.Unit);
- Assert.Equal(expectedValue, convertedQuantity.Value);
- });
- }
-
- [Fact]
- public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits()
- {
- var quantity = new AreaDensity(value: 1, unit: AreaDensity.BaseUnit);
- var expectedUnit = AreaDensity.Info.GetDefaultUnit(UnitSystem.SI);
- var expectedValue = quantity.As(expectedUnit);
-
- IQuantity quantityToConvert = quantity;
-
- IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI);
+ AreaDensity convertedQuantity = quantity.ToUnit(UnitSystem.SI);
Assert.Equal(expectedUnit, convertedQuantity.Unit);
Assert.Equal(expectedValue, convertedQuantity.Value);
@@ -259,46 +231,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits()
public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull()
{
UnitSystem nullUnitSystem = null!;
- Assert.Multiple(() =>
- {
- var quantity = new AreaDensity(value: 1, unit: AreaDensity.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
- }, () =>
- {
- IQuantity quantity = new AreaDensity(value: 1, unit: AreaDensity.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
- });
- }
-
- [Fact]
- public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull()
- {
- UnitSystem nullUnitSystem = null!;
- IQuantity quantity = new AreaDensity(value: 1, unit: AreaDensity.BaseUnit);
- Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem));
+ var quantity = new AreaDensity(value: 1, unit: AreaDensity.BaseUnit);
+ Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
}
[Fact]
public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported()
{
var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits);
- Assert.Multiple(() =>
- {
- var quantity = new AreaDensity(value: 1, unit: AreaDensity.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
- }, () =>
- {
- IQuantity quantity = new AreaDensity(value: 1, unit: AreaDensity.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
- });
- }
-
- [Fact]
- public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported()
- {
- var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits);
- IQuantity quantity = new AreaDensity(value: 1, unit: AreaDensity.BaseUnit);
- Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem));
+ var quantity = new AreaDensity(value: 1, unit: AreaDensity.BaseUnit);
+ Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
}
[Theory]
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AreaMomentOfInertiaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AreaMomentOfInertiaTestsBase.g.cs
index 7476dc3f70..ba59189e55 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/AreaMomentOfInertiaTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AreaMomentOfInertiaTestsBase.g.cs
@@ -239,35 +239,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits()
var expectedUnit = AreaMomentOfInertia.Info.GetDefaultUnit(UnitSystem.SI);
var expectedValue = quantity.As(expectedUnit);
- Assert.Multiple(() =>
- {
- AreaMomentOfInertia quantityToConvert = quantity;
-
- AreaMomentOfInertia convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI);
-
- Assert.Equal(expectedUnit, convertedQuantity.Unit);
- Assert.Equal(expectedValue, convertedQuantity.Value);
- }, () =>
- {
- IQuantity quantityToConvert = quantity;
-
- IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI);
-
- Assert.Equal(expectedUnit, convertedQuantity.Unit);
- Assert.Equal(expectedValue, convertedQuantity.Value);
- });
- }
-
- [Fact]
- public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits()
- {
- var quantity = new AreaMomentOfInertia(value: 1, unit: AreaMomentOfInertia.BaseUnit);
- var expectedUnit = AreaMomentOfInertia.Info.GetDefaultUnit(UnitSystem.SI);
- var expectedValue = quantity.As(expectedUnit);
-
- IQuantity quantityToConvert = quantity;
-
- IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI);
+ AreaMomentOfInertia convertedQuantity = quantity.ToUnit(UnitSystem.SI);
Assert.Equal(expectedUnit, convertedQuantity.Unit);
Assert.Equal(expectedValue, convertedQuantity.Value);
@@ -277,46 +249,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits()
public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull()
{
UnitSystem nullUnitSystem = null!;
- Assert.Multiple(() =>
- {
- var quantity = new AreaMomentOfInertia(value: 1, unit: AreaMomentOfInertia.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
- }, () =>
- {
- IQuantity quantity = new AreaMomentOfInertia(value: 1, unit: AreaMomentOfInertia.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
- });
- }
-
- [Fact]
- public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull()
- {
- UnitSystem nullUnitSystem = null!;
- IQuantity quantity = new AreaMomentOfInertia(value: 1, unit: AreaMomentOfInertia.BaseUnit);
- Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem));
+ var quantity = new AreaMomentOfInertia(value: 1, unit: AreaMomentOfInertia.BaseUnit);
+ Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
}
[Fact]
public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported()
{
var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits);
- Assert.Multiple(() =>
- {
- var quantity = new AreaMomentOfInertia(value: 1, unit: AreaMomentOfInertia.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
- }, () =>
- {
- IQuantity quantity = new AreaMomentOfInertia(value: 1, unit: AreaMomentOfInertia.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
- });
- }
-
- [Fact]
- public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported()
- {
- var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits);
- IQuantity quantity = new AreaMomentOfInertia(value: 1, unit: AreaMomentOfInertia.BaseUnit);
- Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem));
+ var quantity = new AreaMomentOfInertia(value: 1, unit: AreaMomentOfInertia.BaseUnit);
+ Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
}
[Theory]
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AreaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AreaTestsBase.g.cs
index 197378c4e9..cebf87cd99 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/AreaTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AreaTestsBase.g.cs
@@ -287,35 +287,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits()
var expectedUnit = Area.Info.GetDefaultUnit(UnitSystem.SI);
var expectedValue = quantity.As(expectedUnit);
- Assert.Multiple(() =>
- {
- Area quantityToConvert = quantity;
-
- Area convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI);
-
- Assert.Equal(expectedUnit, convertedQuantity.Unit);
- Assert.Equal(expectedValue, convertedQuantity.Value);
- }, () =>
- {
- IQuantity quantityToConvert = quantity;
-
- IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI);
-
- Assert.Equal(expectedUnit, convertedQuantity.Unit);
- Assert.Equal(expectedValue, convertedQuantity.Value);
- });
- }
-
- [Fact]
- public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits()
- {
- var quantity = new Area(value: 1, unit: Area.BaseUnit);
- var expectedUnit = Area.Info.GetDefaultUnit(UnitSystem.SI);
- var expectedValue = quantity.As(expectedUnit);
-
- IQuantity quantityToConvert = quantity;
-
- IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI);
+ Area convertedQuantity = quantity.ToUnit(UnitSystem.SI);
Assert.Equal(expectedUnit, convertedQuantity.Unit);
Assert.Equal(expectedValue, convertedQuantity.Value);
@@ -325,46 +297,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits()
public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull()
{
UnitSystem nullUnitSystem = null!;
- Assert.Multiple(() =>
- {
- var quantity = new Area(value: 1, unit: Area.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
- }, () =>
- {
- IQuantity quantity = new Area(value: 1, unit: Area.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
- });
- }
-
- [Fact]
- public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull()
- {
- UnitSystem nullUnitSystem = null!;
- IQuantity quantity = new Area(value: 1, unit: Area.BaseUnit);
- Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem));
+ var quantity = new Area(value: 1, unit: Area.BaseUnit);
+ Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
}
[Fact]
public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported()
{
var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits);
- Assert.Multiple(() =>
- {
- var quantity = new Area(value: 1, unit: Area.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
- }, () =>
- {
- IQuantity quantity = new Area(value: 1, unit: Area.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
- });
- }
-
- [Fact]
- public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported()
- {
- var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits);
- IQuantity quantity = new Area(value: 1, unit: Area.BaseUnit);
- Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem));
+ var quantity = new Area(value: 1, unit: Area.BaseUnit);
+ Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
}
[Theory]
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/BitRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/BitRateTestsBase.g.cs
index 854e9900b1..5d2d759816 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/BitRateTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/BitRateTestsBase.g.cs
@@ -437,35 +437,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits()
var expectedUnit = BitRate.Info.GetDefaultUnit(UnitSystem.SI);
var expectedValue = quantity.As(expectedUnit);
- Assert.Multiple(() =>
- {
- BitRate quantityToConvert = quantity;
-
- BitRate convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI);
-
- Assert.Equal(expectedUnit, convertedQuantity.Unit);
- Assert.Equal(expectedValue, convertedQuantity.Value);
- }, () =>
- {
- IQuantity quantityToConvert = quantity;
-
- IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI);
-
- Assert.Equal(expectedUnit, convertedQuantity.Unit);
- Assert.Equal(expectedValue, convertedQuantity.Value);
- });
- }
-
- [Fact]
- public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits()
- {
- var quantity = new BitRate(value: 1, unit: BitRate.BaseUnit);
- var expectedUnit = BitRate.Info.GetDefaultUnit(UnitSystem.SI);
- var expectedValue = quantity.As(expectedUnit);
-
- IQuantity quantityToConvert = quantity;
-
- IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI);
+ BitRate convertedQuantity = quantity.ToUnit(UnitSystem.SI);
Assert.Equal(expectedUnit, convertedQuantity.Unit);
Assert.Equal(expectedValue, convertedQuantity.Value);
@@ -475,46 +447,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits()
public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull()
{
UnitSystem nullUnitSystem = null!;
- Assert.Multiple(() =>
- {
- var quantity = new BitRate(value: 1, unit: BitRate.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
- }, () =>
- {
- IQuantity quantity = new BitRate(value: 1, unit: BitRate.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
- });
- }
-
- [Fact]
- public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull()
- {
- UnitSystem nullUnitSystem = null!;
- IQuantity quantity = new BitRate(value: 1, unit: BitRate.BaseUnit);
- Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem));
+ var quantity = new BitRate(value: 1, unit: BitRate.BaseUnit);
+ Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
}
[Fact]
public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported()
{
var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits);
- Assert.Multiple(() =>
- {
- var quantity = new BitRate(value: 1, unit: BitRate.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
- }, () =>
- {
- IQuantity quantity = new BitRate(value: 1, unit: BitRate.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
- });
- }
-
- [Fact]
- public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported()
- {
- var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits);
- IQuantity quantity = new BitRate(value: 1, unit: BitRate.BaseUnit);
- Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem));
+ var quantity = new BitRate(value: 1, unit: BitRate.BaseUnit);
+ Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
}
[Theory]
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/BrakeSpecificFuelConsumptionTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/BrakeSpecificFuelConsumptionTestsBase.g.cs
index 536f5b101f..2a2dc55d8b 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/BrakeSpecificFuelConsumptionTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/BrakeSpecificFuelConsumptionTestsBase.g.cs
@@ -221,35 +221,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits()
var expectedUnit = BrakeSpecificFuelConsumption.Info.GetDefaultUnit(UnitSystem.SI);
var expectedValue = quantity.As(expectedUnit);
- Assert.Multiple(() =>
- {
- BrakeSpecificFuelConsumption quantityToConvert = quantity;
-
- BrakeSpecificFuelConsumption convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI);
-
- Assert.Equal(expectedUnit, convertedQuantity.Unit);
- Assert.Equal(expectedValue, convertedQuantity.Value);
- }, () =>
- {
- IQuantity quantityToConvert = quantity;
-
- IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI);
-
- Assert.Equal(expectedUnit, convertedQuantity.Unit);
- Assert.Equal(expectedValue, convertedQuantity.Value);
- });
- }
-
- [Fact]
- public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits()
- {
- var quantity = new BrakeSpecificFuelConsumption(value: 1, unit: BrakeSpecificFuelConsumption.BaseUnit);
- var expectedUnit = BrakeSpecificFuelConsumption.Info.GetDefaultUnit(UnitSystem.SI);
- var expectedValue = quantity.As(expectedUnit);
-
- IQuantity quantityToConvert = quantity;
-
- IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI);
+ BrakeSpecificFuelConsumption convertedQuantity = quantity.ToUnit(UnitSystem.SI);
Assert.Equal(expectedUnit, convertedQuantity.Unit);
Assert.Equal(expectedValue, convertedQuantity.Value);
@@ -259,46 +231,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits()
public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull()
{
UnitSystem nullUnitSystem = null!;
- Assert.Multiple(() =>
- {
- var quantity = new BrakeSpecificFuelConsumption(value: 1, unit: BrakeSpecificFuelConsumption.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
- }, () =>
- {
- IQuantity quantity = new BrakeSpecificFuelConsumption(value: 1, unit: BrakeSpecificFuelConsumption.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
- });
- }
-
- [Fact]
- public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull()
- {
- UnitSystem nullUnitSystem = null!;
- IQuantity quantity = new BrakeSpecificFuelConsumption(value: 1, unit: BrakeSpecificFuelConsumption.BaseUnit);
- Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem));
+ var quantity = new BrakeSpecificFuelConsumption(value: 1, unit: BrakeSpecificFuelConsumption.BaseUnit);
+ Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
}
[Fact]
public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported()
{
var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits);
- Assert.Multiple(() =>
- {
- var quantity = new BrakeSpecificFuelConsumption(value: 1, unit: BrakeSpecificFuelConsumption.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
- }, () =>
- {
- IQuantity quantity = new BrakeSpecificFuelConsumption(value: 1, unit: BrakeSpecificFuelConsumption.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
- });
- }
-
- [Fact]
- public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported()
- {
- var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits);
- IQuantity quantity = new BrakeSpecificFuelConsumption(value: 1, unit: BrakeSpecificFuelConsumption.BaseUnit);
- Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem));
+ var quantity = new BrakeSpecificFuelConsumption(value: 1, unit: BrakeSpecificFuelConsumption.BaseUnit);
+ Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
}
[Theory]
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/CoefficientOfThermalExpansionTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/CoefficientOfThermalExpansionTestsBase.g.cs
index 64fcb85cca..26119fec3c 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/CoefficientOfThermalExpansionTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/CoefficientOfThermalExpansionTestsBase.g.cs
@@ -239,35 +239,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits()
var expectedUnit = CoefficientOfThermalExpansion.Info.GetDefaultUnit(UnitSystem.SI);
var expectedValue = quantity.As(expectedUnit);
- Assert.Multiple(() =>
- {
- CoefficientOfThermalExpansion quantityToConvert = quantity;
-
- CoefficientOfThermalExpansion convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI);
-
- Assert.Equal(expectedUnit, convertedQuantity.Unit);
- Assert.Equal(expectedValue, convertedQuantity.Value);
- }, () =>
- {
- IQuantity quantityToConvert = quantity;
-
- IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI);
-
- Assert.Equal(expectedUnit, convertedQuantity.Unit);
- Assert.Equal(expectedValue, convertedQuantity.Value);
- });
- }
-
- [Fact]
- public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits()
- {
- var quantity = new CoefficientOfThermalExpansion(value: 1, unit: CoefficientOfThermalExpansion.BaseUnit);
- var expectedUnit = CoefficientOfThermalExpansion.Info.GetDefaultUnit(UnitSystem.SI);
- var expectedValue = quantity.As(expectedUnit);
-
- IQuantity quantityToConvert = quantity;
-
- IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI);
+ CoefficientOfThermalExpansion convertedQuantity = quantity.ToUnit(UnitSystem.SI);
Assert.Equal(expectedUnit, convertedQuantity.Unit);
Assert.Equal(expectedValue, convertedQuantity.Value);
@@ -277,46 +249,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits()
public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull()
{
UnitSystem nullUnitSystem = null!;
- Assert.Multiple(() =>
- {
- var quantity = new CoefficientOfThermalExpansion(value: 1, unit: CoefficientOfThermalExpansion.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
- }, () =>
- {
- IQuantity quantity = new CoefficientOfThermalExpansion(value: 1, unit: CoefficientOfThermalExpansion.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
- });
- }
-
- [Fact]
- public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull()
- {
- UnitSystem nullUnitSystem = null!;
- IQuantity quantity = new CoefficientOfThermalExpansion(value: 1, unit: CoefficientOfThermalExpansion.BaseUnit);
- Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem));
+ var quantity = new CoefficientOfThermalExpansion(value: 1, unit: CoefficientOfThermalExpansion.BaseUnit);
+ Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
}
[Fact]
public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported()
{
var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits);
- Assert.Multiple(() =>
- {
- var quantity = new CoefficientOfThermalExpansion(value: 1, unit: CoefficientOfThermalExpansion.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
- }, () =>
- {
- IQuantity quantity = new CoefficientOfThermalExpansion(value: 1, unit: CoefficientOfThermalExpansion.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
- });
- }
-
- [Fact]
- public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported()
- {
- var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits);
- IQuantity quantity = new CoefficientOfThermalExpansion(value: 1, unit: CoefficientOfThermalExpansion.BaseUnit);
- Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem));
+ var quantity = new CoefficientOfThermalExpansion(value: 1, unit: CoefficientOfThermalExpansion.BaseUnit);
+ Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
}
[Theory]
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/CompressibilityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/CompressibilityTestsBase.g.cs
index 964d15a611..6069068fc7 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/CompressibilityTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/CompressibilityTestsBase.g.cs
@@ -245,35 +245,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits()
var expectedUnit = Compressibility.Info.GetDefaultUnit(UnitSystem.SI);
var expectedValue = quantity.As(expectedUnit);
- Assert.Multiple(() =>
- {
- Compressibility quantityToConvert = quantity;
-
- Compressibility convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI);
-
- Assert.Equal(expectedUnit, convertedQuantity.Unit);
- Assert.Equal(expectedValue, convertedQuantity.Value);
- }, () =>
- {
- IQuantity quantityToConvert = quantity;
-
- IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI);
-
- Assert.Equal(expectedUnit, convertedQuantity.Unit);
- Assert.Equal(expectedValue, convertedQuantity.Value);
- });
- }
-
- [Fact]
- public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits()
- {
- var quantity = new Compressibility(value: 1, unit: Compressibility.BaseUnit);
- var expectedUnit = Compressibility.Info.GetDefaultUnit(UnitSystem.SI);
- var expectedValue = quantity.As(expectedUnit);
-
- IQuantity quantityToConvert = quantity;
-
- IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI);
+ Compressibility convertedQuantity = quantity.ToUnit(UnitSystem.SI);
Assert.Equal(expectedUnit, convertedQuantity.Unit);
Assert.Equal(expectedValue, convertedQuantity.Value);
@@ -283,46 +255,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits()
public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull()
{
UnitSystem nullUnitSystem = null!;
- Assert.Multiple(() =>
- {
- var quantity = new Compressibility(value: 1, unit: Compressibility.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
- }, () =>
- {
- IQuantity quantity = new Compressibility(value: 1, unit: Compressibility.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
- });
- }
-
- [Fact]
- public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull()
- {
- UnitSystem nullUnitSystem = null!;
- IQuantity quantity = new Compressibility(value: 1, unit: Compressibility.BaseUnit);
- Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem));
+ var quantity = new Compressibility(value: 1, unit: Compressibility.BaseUnit);
+ Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
}
[Fact]
public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported()
{
var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits);
- Assert.Multiple(() =>
- {
- var quantity = new Compressibility(value: 1, unit: Compressibility.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
- }, () =>
- {
- IQuantity quantity = new Compressibility(value: 1, unit: Compressibility.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
- });
- }
-
- [Fact]
- public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported()
- {
- var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits);
- IQuantity quantity = new Compressibility(value: 1, unit: Compressibility.BaseUnit);
- Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem));
+ var quantity = new Compressibility(value: 1, unit: Compressibility.BaseUnit);
+ Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
}
[Theory]
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/DensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/DensityTestsBase.g.cs
index 48e3d7e820..77efc0fcc8 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/DensityTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/DensityTestsBase.g.cs
@@ -539,35 +539,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits()
var expectedUnit = Density.Info.GetDefaultUnit(UnitSystem.SI);
var expectedValue = quantity.As(expectedUnit);
- Assert.Multiple(() =>
- {
- Density quantityToConvert = quantity;
-
- Density convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI);
-
- Assert.Equal(expectedUnit, convertedQuantity.Unit);
- Assert.Equal(expectedValue, convertedQuantity.Value);
- }, () =>
- {
- IQuantity quantityToConvert = quantity;
-
- IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI);
-
- Assert.Equal(expectedUnit, convertedQuantity.Unit);
- Assert.Equal(expectedValue, convertedQuantity.Value);
- });
- }
-
- [Fact]
- public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits()
- {
- var quantity = new Density(value: 1, unit: Density.BaseUnit);
- var expectedUnit = Density.Info.GetDefaultUnit(UnitSystem.SI);
- var expectedValue = quantity.As(expectedUnit);
-
- IQuantity quantityToConvert = quantity;
-
- IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI);
+ Density convertedQuantity = quantity.ToUnit(UnitSystem.SI);
Assert.Equal(expectedUnit, convertedQuantity.Unit);
Assert.Equal(expectedValue, convertedQuantity.Value);
@@ -577,46 +549,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits()
public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull()
{
UnitSystem nullUnitSystem = null!;
- Assert.Multiple(() =>
- {
- var quantity = new Density(value: 1, unit: Density.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
- }, () =>
- {
- IQuantity quantity = new Density(value: 1, unit: Density.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
- });
- }
-
- [Fact]
- public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull()
- {
- UnitSystem nullUnitSystem = null!;
- IQuantity quantity = new Density(value: 1, unit: Density.BaseUnit);
- Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem));
+ var quantity = new Density(value: 1, unit: Density.BaseUnit);
+ Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
}
[Fact]
public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported()
{
var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits);
- Assert.Multiple(() =>
- {
- var quantity = new Density(value: 1, unit: Density.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
- }, () =>
- {
- IQuantity quantity = new Density(value: 1, unit: Density.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
- });
- }
-
- [Fact]
- public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported()
- {
- var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits);
- IQuantity quantity = new Density(value: 1, unit: Density.BaseUnit);
- Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem));
+ var quantity = new Density(value: 1, unit: Density.BaseUnit);
+ Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
}
[Theory]
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/DoseAreaProductTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/DoseAreaProductTestsBase.g.cs
index d2c1304e26..61ab4c58b2 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/DoseAreaProductTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/DoseAreaProductTestsBase.g.cs
@@ -353,35 +353,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits()
var expectedUnit = DoseAreaProduct.Info.GetDefaultUnit(UnitSystem.SI);
var expectedValue = quantity.As(expectedUnit);
- Assert.Multiple(() =>
- {
- DoseAreaProduct quantityToConvert = quantity;
-
- DoseAreaProduct convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI);
-
- Assert.Equal(expectedUnit, convertedQuantity.Unit);
- Assert.Equal(expectedValue, convertedQuantity.Value);
- }, () =>
- {
- IQuantity quantityToConvert = quantity;
-
- IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI);
-
- Assert.Equal(expectedUnit, convertedQuantity.Unit);
- Assert.Equal(expectedValue, convertedQuantity.Value);
- });
- }
-
- [Fact]
- public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits()
- {
- var quantity = new DoseAreaProduct(value: 1, unit: DoseAreaProduct.BaseUnit);
- var expectedUnit = DoseAreaProduct.Info.GetDefaultUnit(UnitSystem.SI);
- var expectedValue = quantity.As(expectedUnit);
-
- IQuantity quantityToConvert = quantity;
-
- IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI);
+ DoseAreaProduct convertedQuantity = quantity.ToUnit(UnitSystem.SI);
Assert.Equal(expectedUnit, convertedQuantity.Unit);
Assert.Equal(expectedValue, convertedQuantity.Value);
@@ -391,46 +363,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits()
public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull()
{
UnitSystem nullUnitSystem = null!;
- Assert.Multiple(() =>
- {
- var quantity = new DoseAreaProduct(value: 1, unit: DoseAreaProduct.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
- }, () =>
- {
- IQuantity quantity = new DoseAreaProduct(value: 1, unit: DoseAreaProduct.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
- });
- }
-
- [Fact]
- public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull()
- {
- UnitSystem nullUnitSystem = null!;
- IQuantity quantity = new DoseAreaProduct(value: 1, unit: DoseAreaProduct.BaseUnit);
- Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem));
+ var quantity = new DoseAreaProduct(value: 1, unit: DoseAreaProduct.BaseUnit);
+ Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
}
[Fact]
public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported()
{
var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits);
- Assert.Multiple(() =>
- {
- var quantity = new DoseAreaProduct(value: 1, unit: DoseAreaProduct.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
- }, () =>
- {
- IQuantity quantity = new DoseAreaProduct(value: 1, unit: DoseAreaProduct.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
- });
- }
-
- [Fact]
- public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported()
- {
- var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits);
- IQuantity quantity = new DoseAreaProduct(value: 1, unit: DoseAreaProduct.BaseUnit);
- Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem));
+ var quantity = new DoseAreaProduct(value: 1, unit: DoseAreaProduct.BaseUnit);
+ Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
}
[Theory]
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/DurationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/DurationTestsBase.g.cs
index 1e77b4db99..c6f76a8a57 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/DurationTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/DurationTestsBase.g.cs
@@ -281,35 +281,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits()
var expectedUnit = Duration.Info.GetDefaultUnit(UnitSystem.SI);
var expectedValue = quantity.As(expectedUnit);
- Assert.Multiple(() =>
- {
- Duration quantityToConvert = quantity;
-
- Duration convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI);
-
- Assert.Equal(expectedUnit, convertedQuantity.Unit);
- Assert.Equal(expectedValue, convertedQuantity.Value);
- }, () =>
- {
- IQuantity quantityToConvert = quantity;
-
- IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI);
-
- Assert.Equal(expectedUnit, convertedQuantity.Unit);
- Assert.Equal(expectedValue, convertedQuantity.Value);
- });
- }
-
- [Fact]
- public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits()
- {
- var quantity = new Duration(value: 1, unit: Duration.BaseUnit);
- var expectedUnit = Duration.Info.GetDefaultUnit(UnitSystem.SI);
- var expectedValue = quantity.As(expectedUnit);
-
- IQuantity quantityToConvert = quantity;
-
- IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI);
+ Duration convertedQuantity = quantity.ToUnit(UnitSystem.SI);
Assert.Equal(expectedUnit, convertedQuantity.Unit);
Assert.Equal(expectedValue, convertedQuantity.Value);
@@ -319,46 +291,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits()
public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull()
{
UnitSystem nullUnitSystem = null!;
- Assert.Multiple(() =>
- {
- var quantity = new Duration(value: 1, unit: Duration.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
- }, () =>
- {
- IQuantity quantity = new Duration(value: 1, unit: Duration.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
- });
- }
-
- [Fact]
- public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull()
- {
- UnitSystem nullUnitSystem = null!;
- IQuantity quantity = new Duration(value: 1, unit: Duration.BaseUnit);
- Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem));
+ var quantity = new Duration(value: 1, unit: Duration.BaseUnit);
+ Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
}
[Fact]
public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported()
{
var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits);
- Assert.Multiple(() =>
- {
- var quantity = new Duration(value: 1, unit: Duration.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
- }, () =>
- {
- IQuantity quantity = new Duration(value: 1, unit: Duration.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
- });
- }
-
- [Fact]
- public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported()
- {
- var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits);
- IQuantity quantity = new Duration(value: 1, unit: Duration.BaseUnit);
- Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem));
+ var quantity = new Duration(value: 1, unit: Duration.BaseUnit);
+ Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
}
[Theory]
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/DynamicViscosityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/DynamicViscosityTestsBase.g.cs
index 483cff37e8..12ac7a9c89 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/DynamicViscosityTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/DynamicViscosityTestsBase.g.cs
@@ -263,35 +263,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits()
var expectedUnit = DynamicViscosity.Info.GetDefaultUnit(UnitSystem.SI);
var expectedValue = quantity.As(expectedUnit);
- Assert.Multiple(() =>
- {
- DynamicViscosity quantityToConvert = quantity;
-
- DynamicViscosity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI);
-
- Assert.Equal(expectedUnit, convertedQuantity.Unit);
- Assert.Equal(expectedValue, convertedQuantity.Value);
- }, () =>
- {
- IQuantity quantityToConvert = quantity;
-
- IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI);
-
- Assert.Equal(expectedUnit, convertedQuantity.Unit);
- Assert.Equal(expectedValue, convertedQuantity.Value);
- });
- }
-
- [Fact]
- public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits()
- {
- var quantity = new DynamicViscosity(value: 1, unit: DynamicViscosity.BaseUnit);
- var expectedUnit = DynamicViscosity.Info.GetDefaultUnit(UnitSystem.SI);
- var expectedValue = quantity.As(expectedUnit);
-
- IQuantity quantityToConvert = quantity;
-
- IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI);
+ DynamicViscosity convertedQuantity = quantity.ToUnit(UnitSystem.SI);
Assert.Equal(expectedUnit, convertedQuantity.Unit);
Assert.Equal(expectedValue, convertedQuantity.Value);
@@ -301,46 +273,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits()
public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull()
{
UnitSystem nullUnitSystem = null!;
- Assert.Multiple(() =>
- {
- var quantity = new DynamicViscosity(value: 1, unit: DynamicViscosity.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
- }, () =>
- {
- IQuantity quantity = new DynamicViscosity(value: 1, unit: DynamicViscosity.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
- });
- }
-
- [Fact]
- public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull()
- {
- UnitSystem nullUnitSystem = null!;
- IQuantity quantity = new DynamicViscosity(value: 1, unit: DynamicViscosity.BaseUnit);
- Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem));
+ var quantity = new DynamicViscosity(value: 1, unit: DynamicViscosity.BaseUnit);
+ Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
}
[Fact]
public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported()
{
var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits);
- Assert.Multiple(() =>
- {
- var quantity = new DynamicViscosity(value: 1, unit: DynamicViscosity.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
- }, () =>
- {
- IQuantity quantity = new DynamicViscosity(value: 1, unit: DynamicViscosity.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
- });
- }
-
- [Fact]
- public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported()
- {
- var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits);
- IQuantity quantity = new DynamicViscosity(value: 1, unit: DynamicViscosity.BaseUnit);
- Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem));
+ var quantity = new DynamicViscosity(value: 1, unit: DynamicViscosity.BaseUnit);
+ Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
}
[Theory]
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricAdmittanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricAdmittanceTestsBase.g.cs
index 5e8754b5ee..acb1078b4b 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricAdmittanceTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricAdmittanceTestsBase.g.cs
@@ -299,35 +299,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits()
var expectedUnit = ElectricAdmittance.Info.GetDefaultUnit(UnitSystem.SI);
var expectedValue = quantity.As(expectedUnit);
- Assert.Multiple(() =>
- {
- ElectricAdmittance quantityToConvert = quantity;
-
- ElectricAdmittance convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI);
-
- Assert.Equal(expectedUnit, convertedQuantity.Unit);
- Assert.Equal(expectedValue, convertedQuantity.Value);
- }, () =>
- {
- IQuantity quantityToConvert = quantity;
-
- IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI);
-
- Assert.Equal(expectedUnit, convertedQuantity.Unit);
- Assert.Equal(expectedValue, convertedQuantity.Value);
- });
- }
-
- [Fact]
- public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits()
- {
- var quantity = new ElectricAdmittance(value: 1, unit: ElectricAdmittance.BaseUnit);
- var expectedUnit = ElectricAdmittance.Info.GetDefaultUnit(UnitSystem.SI);
- var expectedValue = quantity.As(expectedUnit);
-
- IQuantity quantityToConvert = quantity;
-
- IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI);
+ ElectricAdmittance convertedQuantity = quantity.ToUnit(UnitSystem.SI);
Assert.Equal(expectedUnit, convertedQuantity.Unit);
Assert.Equal(expectedValue, convertedQuantity.Value);
@@ -337,46 +309,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits()
public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull()
{
UnitSystem nullUnitSystem = null!;
- Assert.Multiple(() =>
- {
- var quantity = new ElectricAdmittance(value: 1, unit: ElectricAdmittance.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
- }, () =>
- {
- IQuantity quantity = new ElectricAdmittance(value: 1, unit: ElectricAdmittance.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
- });
- }
-
- [Fact]
- public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull()
- {
- UnitSystem nullUnitSystem = null!;
- IQuantity quantity = new ElectricAdmittance(value: 1, unit: ElectricAdmittance.BaseUnit);
- Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem));
+ var quantity = new ElectricAdmittance(value: 1, unit: ElectricAdmittance.BaseUnit);
+ Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
}
[Fact]
public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported()
{
var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits);
- Assert.Multiple(() =>
- {
- var quantity = new ElectricAdmittance(value: 1, unit: ElectricAdmittance.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
- }, () =>
- {
- IQuantity quantity = new ElectricAdmittance(value: 1, unit: ElectricAdmittance.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
- });
- }
-
- [Fact]
- public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported()
- {
- var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits);
- IQuantity quantity = new ElectricAdmittance(value: 1, unit: ElectricAdmittance.BaseUnit);
- Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem));
+ var quantity = new ElectricAdmittance(value: 1, unit: ElectricAdmittance.BaseUnit);
+ Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
}
[Theory]
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricApparentEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricApparentEnergyTestsBase.g.cs
index 79f5ea0993..70c351debd 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricApparentEnergyTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricApparentEnergyTestsBase.g.cs
@@ -221,35 +221,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits()
var expectedUnit = ElectricApparentEnergy.Info.GetDefaultUnit(UnitSystem.SI);
var expectedValue = quantity.As(expectedUnit);
- Assert.Multiple(() =>
- {
- ElectricApparentEnergy quantityToConvert = quantity;
-
- ElectricApparentEnergy convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI);
-
- Assert.Equal(expectedUnit, convertedQuantity.Unit);
- Assert.Equal(expectedValue, convertedQuantity.Value);
- }, () =>
- {
- IQuantity quantityToConvert = quantity;
-
- IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI);
-
- Assert.Equal(expectedUnit, convertedQuantity.Unit);
- Assert.Equal(expectedValue, convertedQuantity.Value);
- });
- }
-
- [Fact]
- public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits()
- {
- var quantity = new ElectricApparentEnergy(value: 1, unit: ElectricApparentEnergy.BaseUnit);
- var expectedUnit = ElectricApparentEnergy.Info.GetDefaultUnit(UnitSystem.SI);
- var expectedValue = quantity.As(expectedUnit);
-
- IQuantity quantityToConvert = quantity;
-
- IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI);
+ ElectricApparentEnergy convertedQuantity = quantity.ToUnit(UnitSystem.SI);
Assert.Equal(expectedUnit, convertedQuantity.Unit);
Assert.Equal(expectedValue, convertedQuantity.Value);
@@ -259,46 +231,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits()
public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull()
{
UnitSystem nullUnitSystem = null!;
- Assert.Multiple(() =>
- {
- var quantity = new ElectricApparentEnergy(value: 1, unit: ElectricApparentEnergy.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
- }, () =>
- {
- IQuantity quantity = new ElectricApparentEnergy(value: 1, unit: ElectricApparentEnergy.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
- });
- }
-
- [Fact]
- public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull()
- {
- UnitSystem nullUnitSystem = null!;
- IQuantity quantity = new ElectricApparentEnergy(value: 1, unit: ElectricApparentEnergy.BaseUnit);
- Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem));
+ var quantity = new ElectricApparentEnergy(value: 1, unit: ElectricApparentEnergy.BaseUnit);
+ Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
}
[Fact]
public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported()
{
var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits);
- Assert.Multiple(() =>
- {
- var quantity = new ElectricApparentEnergy(value: 1, unit: ElectricApparentEnergy.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
- }, () =>
- {
- IQuantity quantity = new ElectricApparentEnergy(value: 1, unit: ElectricApparentEnergy.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
- });
- }
-
- [Fact]
- public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported()
- {
- var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits);
- IQuantity quantity = new ElectricApparentEnergy(value: 1, unit: ElectricApparentEnergy.BaseUnit);
- Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem));
+ var quantity = new ElectricApparentEnergy(value: 1, unit: ElectricApparentEnergy.BaseUnit);
+ Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
}
[Theory]
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricApparentPowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricApparentPowerTestsBase.g.cs
index 8572daa8ff..ce74ec86aa 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricApparentPowerTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricApparentPowerTestsBase.g.cs
@@ -239,35 +239,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits()
var expectedUnit = ElectricApparentPower.Info.GetDefaultUnit(UnitSystem.SI);
var expectedValue = quantity.As(expectedUnit);
- Assert.Multiple(() =>
- {
- ElectricApparentPower quantityToConvert = quantity;
-
- ElectricApparentPower convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI);
-
- Assert.Equal(expectedUnit, convertedQuantity.Unit);
- Assert.Equal(expectedValue, convertedQuantity.Value);
- }, () =>
- {
- IQuantity quantityToConvert = quantity;
-
- IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI);
-
- Assert.Equal(expectedUnit, convertedQuantity.Unit);
- Assert.Equal(expectedValue, convertedQuantity.Value);
- });
- }
-
- [Fact]
- public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits()
- {
- var quantity = new ElectricApparentPower(value: 1, unit: ElectricApparentPower.BaseUnit);
- var expectedUnit = ElectricApparentPower.Info.GetDefaultUnit(UnitSystem.SI);
- var expectedValue = quantity.As(expectedUnit);
-
- IQuantity quantityToConvert = quantity;
-
- IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI);
+ ElectricApparentPower convertedQuantity = quantity.ToUnit(UnitSystem.SI);
Assert.Equal(expectedUnit, convertedQuantity.Unit);
Assert.Equal(expectedValue, convertedQuantity.Value);
@@ -277,46 +249,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits()
public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull()
{
UnitSystem nullUnitSystem = null!;
- Assert.Multiple(() =>
- {
- var quantity = new ElectricApparentPower(value: 1, unit: ElectricApparentPower.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
- }, () =>
- {
- IQuantity quantity = new ElectricApparentPower(value: 1, unit: ElectricApparentPower.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
- });
- }
-
- [Fact]
- public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull()
- {
- UnitSystem nullUnitSystem = null!;
- IQuantity quantity = new ElectricApparentPower(value: 1, unit: ElectricApparentPower.BaseUnit);
- Assert.Throws(() => quantity.ToUnitUntyped(nullUnitSystem));
+ var quantity = new ElectricApparentPower(value: 1, unit: ElectricApparentPower.BaseUnit);
+ Assert.Throws(() => quantity.ToUnit(nullUnitSystem));
}
[Fact]
public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported()
{
var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits);
- Assert.Multiple(() =>
- {
- var quantity = new ElectricApparentPower(value: 1, unit: ElectricApparentPower.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
- }, () =>
- {
- IQuantity quantity = new ElectricApparentPower(value: 1, unit: ElectricApparentPower.BaseUnit);
- Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
- });
- }
-
- [Fact]
- public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported()
- {
- var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits);
- IQuantity quantity = new ElectricApparentPower(value: 1, unit: ElectricApparentPower.BaseUnit);
- Assert.Throws(() => quantity.ToUnitUntyped(unsupportedUnitSystem));
+ var quantity = new ElectricApparentPower(value: 1, unit: ElectricApparentPower.BaseUnit);
+ Assert.Throws(() => quantity.ToUnit(unsupportedUnitSystem));
}
[Theory]
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCapacitanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCapacitanceTestsBase.g.cs
index f6c32ffea9..ba285112ff 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCapacitanceTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCapacitanceTestsBase.g.cs
@@ -245,35 +245,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits()
var expectedUnit = ElectricCapacitance.Info.GetDefaultUnit(UnitSystem.SI);
var expectedValue = quantity.As(expectedUnit);
- Assert.Multiple(() =>
- {
- ElectricCapacitance quantityToConvert = quantity;
-
- ElectricCapacitance convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI);
-
- Assert.Equal(expectedUnit, convertedQuantity.Unit);
- Assert.Equal(expectedValue, convertedQuantity.Value);
- }, () =>
- {
- IQuantity quantityToConvert = quantity;
-
- IQuantity convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI);
-
- Assert.Equal(expectedUnit, convertedQuantity.Unit);
- Assert.Equal(expectedValue, convertedQuantity.Value);
- });
- }
-
- [Fact]
- public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits()
- {
- var quantity = new ElectricCapacitance(value: 1, unit: ElectricCapacitance.BaseUnit);
- var expectedUnit = ElectricCapacitance.Info.GetDefaultUnit(UnitSystem.SI);
- var expectedValue = quantity.As(expectedUnit);
-
- IQuantity quantityToConvert = quantity;
-
- IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI);
+ ElectricCapacitance convertedQuantity = quantity.ToUnit(UnitSystem.SI);
Assert.Equal(expectedUnit, convertedQuantity.Unit);
Assert.Equal(expectedValue, convertedQuantity.Value);
@@ -283,46 +255,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits()
public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull()
{
UnitSystem nullUnitSystem = null!;
- Assert.Multiple(() =>
- {
- var quantity = new ElectricCapacitance(value: 1, unit: ElectricCapacitance.BaseUnit);
- Assert.Throws