diff --git a/Common/UnitDefinitions/VolumetricHeatCapacity.json b/Common/UnitDefinitions/VolumetricHeatCapacity.json new file mode 100644 index 0000000000..efe274e498 --- /dev/null +++ b/Common/UnitDefinitions/VolumetricHeatCapacity.json @@ -0,0 +1,65 @@ +{ + "Name": "VolumetricHeatCapacity", + "BaseUnit": "JoulePerCubicMeterKelvin", + "XmlDoc": "The volumetric heat capacity is the amount of energy that must be added, in the form of heat, to one unit of volume of the material in order to cause an increase of one unit in its temperature.", + "XmlDocRemarks": "https://en.wikipedia.org/wiki/Volumetric_heat_capacity", + "BaseDimensions": { + "M": 1, + "L": -1, + "T": -2, + "Θ": -1 + }, + "Units": [ + { + "SingularName": "JoulePerCubicMeterKelvin", + "PluralName": "JoulesPerCubicMeterKelvin", + "FromUnitToBaseFunc": "x", + "FromBaseToUnitFunc": "x", + "Prefixes": [ "Kilo", "Mega" ], + "Localization": [ + { + "Culture": "en-US", + "Abbreviations": [ "J/m³·K" ] + } + ] + }, + { + "SingularName": "JoulePerCubicMeterDegreeCelsius", + "PluralName": "JoulesPerCubicMeterDegreeCelsius", + "FromUnitToBaseFunc": "x", + "FromBaseToUnitFunc": "x", + "Prefixes": [ "Kilo", "Mega" ], + "Localization": [ + { + "Culture": "en-US", + "Abbreviations": [ "J/m³·°C" ] + } + ] + }, + { + "SingularName": "CaloriePerCubicCentimeterDegreeCelsius", + "PluralName": "CaloriesPerCubicCentimeterDegreeCelsius", + "FromUnitToBaseFunc": "x / 2.388459e-7", + "FromBaseToUnitFunc": "x * 2.388459e-7", + "Prefixes": [ "Kilo" ], + "Localization": [ + { + "Culture": "en-US", + "Abbreviations": [ "cal/cm³·°C" ] + } + ] + }, + { + "SingularName": "BtuPerCubicFootDegreeFahrenheit", + "PluralName": "BtusPerCubicFootDegreeFahrenheit", + "FromUnitToBaseFunc": "x / 1.4910660e-5", + "FromBaseToUnitFunc": "x * 1.4910660e-5", + "Localization": [ + { + "Culture": "en-US", + "Abbreviations": [ "BTU/ft³·°F" ] + } + ] + } + ] +} diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs new file mode 100644 index 0000000000..b43908c014 --- /dev/null +++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs @@ -0,0 +1,270 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// 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 UnitsNet.Units; + +namespace UnitsNet +{ + /// + /// + /// The volumetric heat capacity is the amount of energy that must be added, in the form of heat, to one unit of volume of the material in order to cause an increase of one unit in its temperature. + /// + /// + /// https://en.wikipedia.org/wiki/Volumetric_heat_capacity + /// + public struct VolumetricHeatCapacity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly VolumetricHeatCapacityUnit _unit; + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + /// + public VolumetricHeatCapacityUnit Unit => _unit; + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to construct this quantity with. + /// The unit representation to construct this quantity with. + /// If value is NaN or Infinity. + public VolumetricHeatCapacity(double value, VolumetricHeatCapacityUnit unit) + { + _value = value; + _unit = unit; + } + + /// + /// The base unit of Duration, which is Second. All conversions go via this value. + /// + public static VolumetricHeatCapacityUnit BaseUnit { get; } = VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin; + + /// + /// Represents the largest possible value of Duration + /// + public static VolumetricHeatCapacity MaxValue { get; } = new VolumetricHeatCapacity(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of Duration + /// + public static VolumetricHeatCapacity MinValue { get; } = new VolumetricHeatCapacity(double.MinValue, BaseUnit); + /// + /// Gets an instance of this quantity with a value of 0 in the base unit Second. + /// + public static VolumetricHeatCapacity Zero { get; } = new VolumetricHeatCapacity(0, BaseUnit); + #region Conversion Properties + + /// + /// Get VolumetricHeatCapacity in BtusPerCubicFootDegreeFahrenheit. + /// + public double BtusPerCubicFootDegreeFahrenheit => As(VolumetricHeatCapacityUnit.BtuPerCubicFootDegreeFahrenheit); + + /// + /// Get VolumetricHeatCapacity in CaloriesPerCubicCentimeterDegreeCelsius. + /// + public double CaloriesPerCubicCentimeterDegreeCelsius => As(VolumetricHeatCapacityUnit.CaloriePerCubicCentimeterDegreeCelsius); + + /// + /// Get VolumetricHeatCapacity in JoulesPerCubicMeterDegreeCelsius. + /// + public double JoulesPerCubicMeterDegreeCelsius => As(VolumetricHeatCapacityUnit.JoulePerCubicMeterDegreeCelsius); + + /// + /// Get VolumetricHeatCapacity in JoulesPerCubicMeterKelvin. + /// + public double JoulesPerCubicMeterKelvin => As(VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin); + + /// + /// Get VolumetricHeatCapacity in KilocaloriesPerCubicCentimeterDegreeCelsius. + /// + public double KilocaloriesPerCubicCentimeterDegreeCelsius => As(VolumetricHeatCapacityUnit.KilocaloriePerCubicCentimeterDegreeCelsius); + + /// + /// Get VolumetricHeatCapacity in KilojoulesPerCubicMeterDegreeCelsius. + /// + public double KilojoulesPerCubicMeterDegreeCelsius => As(VolumetricHeatCapacityUnit.KilojoulePerCubicMeterDegreeCelsius); + + /// + /// Get VolumetricHeatCapacity in KilojoulesPerCubicMeterKelvin. + /// + public double KilojoulesPerCubicMeterKelvin => As(VolumetricHeatCapacityUnit.KilojoulePerCubicMeterKelvin); + + /// + /// Get VolumetricHeatCapacity in MegajoulesPerCubicMeterDegreeCelsius. + /// + public double MegajoulesPerCubicMeterDegreeCelsius => As(VolumetricHeatCapacityUnit.MegajoulePerCubicMeterDegreeCelsius); + + /// + /// Get VolumetricHeatCapacity in MegajoulesPerCubicMeterKelvin. + /// + public double MegajoulesPerCubicMeterKelvin => As(VolumetricHeatCapacityUnit.MegajoulePerCubicMeterKelvin); + + #endregion + + #region Static Factory Methods + + /// + /// Get VolumetricHeatCapacity from BtusPerCubicFootDegreeFahrenheit. + /// + /// If value is NaN or Infinity. + public static VolumetricHeatCapacity FromBtusPerCubicFootDegreeFahrenheit(double btuspercubicfootdegreefahrenheit) => new VolumetricHeatCapacity(btuspercubicfootdegreefahrenheit, VolumetricHeatCapacityUnit.BtuPerCubicFootDegreeFahrenheit); + + /// + /// Get VolumetricHeatCapacity from CaloriesPerCubicCentimeterDegreeCelsius. + /// + /// If value is NaN or Infinity. + public static VolumetricHeatCapacity FromCaloriesPerCubicCentimeterDegreeCelsius(double caloriespercubiccentimeterdegreecelsius) => new VolumetricHeatCapacity(caloriespercubiccentimeterdegreecelsius, VolumetricHeatCapacityUnit.CaloriePerCubicCentimeterDegreeCelsius); + + /// + /// Get VolumetricHeatCapacity from JoulesPerCubicMeterDegreeCelsius. + /// + /// If value is NaN or Infinity. + public static VolumetricHeatCapacity FromJoulesPerCubicMeterDegreeCelsius(double joulespercubicmeterdegreecelsius) => new VolumetricHeatCapacity(joulespercubicmeterdegreecelsius, VolumetricHeatCapacityUnit.JoulePerCubicMeterDegreeCelsius); + + /// + /// Get VolumetricHeatCapacity from JoulesPerCubicMeterKelvin. + /// + /// If value is NaN or Infinity. + public static VolumetricHeatCapacity FromJoulesPerCubicMeterKelvin(double joulespercubicmeterkelvin) => new VolumetricHeatCapacity(joulespercubicmeterkelvin, VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin); + + /// + /// Get VolumetricHeatCapacity from KilocaloriesPerCubicCentimeterDegreeCelsius. + /// + /// If value is NaN or Infinity. + public static VolumetricHeatCapacity FromKilocaloriesPerCubicCentimeterDegreeCelsius(double kilocaloriespercubiccentimeterdegreecelsius) => new VolumetricHeatCapacity(kilocaloriespercubiccentimeterdegreecelsius, VolumetricHeatCapacityUnit.KilocaloriePerCubicCentimeterDegreeCelsius); + + /// + /// Get VolumetricHeatCapacity from KilojoulesPerCubicMeterDegreeCelsius. + /// + /// If value is NaN or Infinity. + public static VolumetricHeatCapacity FromKilojoulesPerCubicMeterDegreeCelsius(double kilojoulespercubicmeterdegreecelsius) => new VolumetricHeatCapacity(kilojoulespercubicmeterdegreecelsius, VolumetricHeatCapacityUnit.KilojoulePerCubicMeterDegreeCelsius); + + /// + /// Get VolumetricHeatCapacity from KilojoulesPerCubicMeterKelvin. + /// + /// If value is NaN or Infinity. + public static VolumetricHeatCapacity FromKilojoulesPerCubicMeterKelvin(double kilojoulespercubicmeterkelvin) => new VolumetricHeatCapacity(kilojoulespercubicmeterkelvin, VolumetricHeatCapacityUnit.KilojoulePerCubicMeterKelvin); + + /// + /// Get VolumetricHeatCapacity from MegajoulesPerCubicMeterDegreeCelsius. + /// + /// If value is NaN or Infinity. + public static VolumetricHeatCapacity FromMegajoulesPerCubicMeterDegreeCelsius(double megajoulespercubicmeterdegreecelsius) => new VolumetricHeatCapacity(megajoulespercubicmeterdegreecelsius, VolumetricHeatCapacityUnit.MegajoulePerCubicMeterDegreeCelsius); + + /// + /// Get VolumetricHeatCapacity from MegajoulesPerCubicMeterKelvin. + /// + /// If value is NaN or Infinity. + public static VolumetricHeatCapacity FromMegajoulesPerCubicMeterKelvin(double megajoulespercubicmeterkelvin) => new VolumetricHeatCapacity(megajoulespercubicmeterkelvin, VolumetricHeatCapacityUnit.MegajoulePerCubicMeterKelvin); + + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// VolumetricHeatCapacity unit value. + public static VolumetricHeatCapacity From(double value, VolumetricHeatCapacityUnit fromUnit) + { + return new VolumetricHeatCapacity(value, fromUnit); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(VolumetricHeatCapacityUnit unit) => GetValueAs(unit); + + /// + /// Converts this Duration to another Duration with the unit representation . + /// + /// A Duration with the specified unit. + public VolumetricHeatCapacity ToUnit(VolumetricHeatCapacityUnit unit) + { + + var convertedValue = GetValueAs(unit); + return new VolumetricHeatCapacity(convertedValue, unit); + } + + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double GetValueInBaseUnit() + { + switch(Unit) + { + case VolumetricHeatCapacityUnit.BtuPerCubicFootDegreeFahrenheit: return _value / 1.4910660e-5; + case VolumetricHeatCapacityUnit.CaloriePerCubicCentimeterDegreeCelsius: return _value / 2.388459e-7; + case VolumetricHeatCapacityUnit.JoulePerCubicMeterDegreeCelsius: return _value; + case VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin: return _value; + case VolumetricHeatCapacityUnit.KilocaloriePerCubicCentimeterDegreeCelsius: return (_value / 2.388459e-7) * 1e3d; + case VolumetricHeatCapacityUnit.KilojoulePerCubicMeterDegreeCelsius: return (_value) * 1e3d; + case VolumetricHeatCapacityUnit.KilojoulePerCubicMeterKelvin: return (_value) * 1e3d; + case VolumetricHeatCapacityUnit.MegajoulePerCubicMeterDegreeCelsius: return (_value) * 1e6d; + case VolumetricHeatCapacityUnit.MegajoulePerCubicMeterKelvin: return (_value) * 1e6d; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double GetValueAs(VolumetricHeatCapacityUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = GetValueInBaseUnit(); + + switch(unit) + { + case VolumetricHeatCapacityUnit.BtuPerCubicFootDegreeFahrenheit: return baseUnitValue * 1.4910660e-5; + case VolumetricHeatCapacityUnit.CaloriePerCubicCentimeterDegreeCelsius: return baseUnitValue * 2.388459e-7; + case VolumetricHeatCapacityUnit.JoulePerCubicMeterDegreeCelsius: return baseUnitValue; + case VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin: return baseUnitValue; + case VolumetricHeatCapacityUnit.KilocaloriePerCubicCentimeterDegreeCelsius: return (baseUnitValue * 2.388459e-7) / 1e3d; + case VolumetricHeatCapacityUnit.KilojoulePerCubicMeterDegreeCelsius: return (baseUnitValue) / 1e3d; + case VolumetricHeatCapacityUnit.KilojoulePerCubicMeterKelvin: return (baseUnitValue) / 1e3d; + case VolumetricHeatCapacityUnit.MegajoulePerCubicMeterDegreeCelsius: return (baseUnitValue) / 1e6d; + case VolumetricHeatCapacityUnit.MegajoulePerCubicMeterKelvin: return (baseUnitValue) / 1e6d; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + } +} + diff --git a/UnitsNet.NanoFramework/GeneratedCode/Units/VolumetricHeatCapacityUnit.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Units/VolumetricHeatCapacityUnit.g.cs new file mode 100644 index 0000000000..2f18602337 --- /dev/null +++ b/UnitsNet.NanoFramework/GeneratedCode/Units/VolumetricHeatCapacityUnit.g.cs @@ -0,0 +1,41 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// 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. + +// ReSharper disable once CheckNamespace +namespace UnitsNet.Units +{ + // Disable missing XML comment warnings for the generated unit enums. + #pragma warning disable 1591 + + public enum VolumetricHeatCapacityUnit + { + Undefined = 0, + BtuPerCubicFootDegreeFahrenheit, + CaloriePerCubicCentimeterDegreeCelsius, + JoulePerCubicMeterDegreeCelsius, + JoulePerCubicMeterKelvin, + KilocaloriePerCubicCentimeterDegreeCelsius, + KilojoulePerCubicMeterDegreeCelsius, + KilojoulePerCubicMeterKelvin, + MegajoulePerCubicMeterDegreeCelsius, + MegajoulePerCubicMeterKelvin, + } + + #pragma warning restore 1591 +} diff --git a/UnitsNet.NanoFramework/GeneratedCode/UnitsNet.nanoFramework.sln b/UnitsNet.NanoFramework/GeneratedCode/UnitsNet.nanoFramework.sln index 37c79ff348..99ed82fca7 100644 --- a/UnitsNet.NanoFramework/GeneratedCode/UnitsNet.nanoFramework.sln +++ b/UnitsNet.NanoFramework/GeneratedCode/UnitsNet.nanoFramework.sln @@ -214,6 +214,8 @@ Project("{d608a2b1-6ead-4383-a205-ad1ce69d9ef7}") = "VolumeFlow", "VolumeFlow\Vo EndProject Project("{d608a2b1-6ead-4383-a205-ad1ce69d9ef7}") = "VolumePerLength", "VolumePerLength\VolumePerLength.nfproj", "{b66e3a3e-7945-3d40-24ef-73fa6e1b8d41}" EndProject +Project("{d608a2b1-6ead-4383-a205-ad1ce69d9ef7}") = "VolumetricHeatCapacity", "VolumetricHeatCapacity\VolumetricHeatCapacity.nfproj", "{cd2b60c1-a4b5-36f2-afa3-6cf1031f9e7f}" +EndProject Project("{d608a2b1-6ead-4383-a205-ad1ce69d9ef7}") = "WarpingMomentOfInertia", "WarpingMomentOfInertia\WarpingMomentOfInertia.nfproj", "{8433aac6-218d-9b7b-6eaa-36774e165446}" EndProject Global @@ -858,6 +860,12 @@ Global {b66e3a3e-7945-3d40-24ef-73fa6e1b8d41}.Release|Any CPU.ActiveCfg = Release|Any CPU {b66e3a3e-7945-3d40-24ef-73fa6e1b8d41}.Release|Any CPU.Build.0 = Release|Any CPU {b66e3a3e-7945-3d40-24ef-73fa6e1b8d41}.Release|Any CPU.Deploy.0 = Release|Any CPU +{cd2b60c1-a4b5-36f2-afa3-6cf1031f9e7f}.Debug|Any CPU.ActiveCfg = Debug|Any CPU +{cd2b60c1-a4b5-36f2-afa3-6cf1031f9e7f}.Debug|Any CPU.Build.0 = Debug|Any CPU +{cd2b60c1-a4b5-36f2-afa3-6cf1031f9e7f}.Debug|Any CPU.Deploy.0 = Debug|Any CPU +{cd2b60c1-a4b5-36f2-afa3-6cf1031f9e7f}.Release|Any CPU.ActiveCfg = Release|Any CPU +{cd2b60c1-a4b5-36f2-afa3-6cf1031f9e7f}.Release|Any CPU.Build.0 = Release|Any CPU +{cd2b60c1-a4b5-36f2-afa3-6cf1031f9e7f}.Release|Any CPU.Deploy.0 = Release|Any CPU {8433aac6-218d-9b7b-6eaa-36774e165446}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8433aac6-218d-9b7b-6eaa-36774e165446}.Debug|Any CPU.Build.0 = Debug|Any CPU {8433aac6-218d-9b7b-6eaa-36774e165446}.Debug|Any CPU.Deploy.0 = Debug|Any CPU diff --git a/UnitsNet.NanoFramework/GeneratedCode/VolumetricHeatCapacity/UnitsNet.NanoFramework.VolumetricHeatCapacity.nuspec b/UnitsNet.NanoFramework/GeneratedCode/VolumetricHeatCapacity/UnitsNet.NanoFramework.VolumetricHeatCapacity.nuspec new file mode 100644 index 0000000000..d0bf6bd777 --- /dev/null +++ b/UnitsNet.NanoFramework/GeneratedCode/VolumetricHeatCapacity/UnitsNet.NanoFramework.VolumetricHeatCapacity.nuspec @@ -0,0 +1,26 @@ + + + + UnitsNet.nanoFramework.VolumetricHeatCapacity + 4.96.0 + Units.NET VolumetricHeatCapacity - nanoFramework + Andreas Gullberg Larsen,nanoFramework project contributors + UnitsNet + MIT + https://github.com/angularsen/UnitsNet + false + Adds VolumetricHeatCapacity units for Units.NET on .NET nanoFramework. For .NET or .NET Core, use UnitsNet instead. + https://raw.githubusercontent.com/angularsen/UnitsNet/ce85185429be345d77eb2ce09c99d59cc9ab8aed/Docs/Images/logo-32.png + + + Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). + en-US + nanoframework unit units measurement si metric imperial abbreviation abbreviations convert conversion parse c# .net immutable uwp uap winrt win10 windows runtime component volumetricheatcapacity + + + + + + + + diff --git a/UnitsNet.NanoFramework/GeneratedCode/VolumetricHeatCapacity/VolumetricHeatCapacity.nfproj b/UnitsNet.NanoFramework/GeneratedCode/VolumetricHeatCapacity/VolumetricHeatCapacity.nfproj new file mode 100644 index 0000000000..bceaa66fa6 --- /dev/null +++ b/UnitsNet.NanoFramework/GeneratedCode/VolumetricHeatCapacity/VolumetricHeatCapacity.nfproj @@ -0,0 +1,42 @@ + + + + $(MSBuildToolsPath)..\..\..\nanoFramework\v1.0\ + + + + Debug + AnyCPU + {11A8DD76-328B-46DF-9F39-F559912D0360};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + {cd2b60c1-a4b5-36f2-afa3-6cf1031f9e7f} + Library + Properties + 512 + UnitsNet + UnitsNet.VolumetricHeatCapacity + v1.0 + bin\$(Configuration)\$(AssemblyName).xml + + + + + + + + + + ..\packages\nanoFramework.CoreLibrary.1.10.5-preview.18\lib\mscorlib.dll + True + True + + + + + + + + + + + + diff --git a/UnitsNet.NanoFramework/GeneratedCode/VolumetricHeatCapacity/packages.config b/UnitsNet.NanoFramework/GeneratedCode/VolumetricHeatCapacity/packages.config new file mode 100644 index 0000000000..dc595a08dd --- /dev/null +++ b/UnitsNet.NanoFramework/GeneratedCode/VolumetricHeatCapacity/packages.config @@ -0,0 +1,4 @@ + + + + diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToVolumetricHeatCapacityExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToVolumetricHeatCapacityExtensionsTest.g.cs new file mode 100644 index 0000000000..5e590da4f0 --- /dev/null +++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToVolumetricHeatCapacityExtensionsTest.g.cs @@ -0,0 +1,64 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// 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 UnitsNet.NumberExtensions.NumberToVolumetricHeatCapacity; +using Xunit; + +namespace UnitsNet.Tests +{ + public class NumberToVolumetricHeatCapacityExtensionsTests + { + [Fact] + public void NumberToBtusPerCubicFootDegreeFahrenheitTest() => + Assert.Equal(VolumetricHeatCapacity.FromBtusPerCubicFootDegreeFahrenheit(2), 2.BtusPerCubicFootDegreeFahrenheit()); + + [Fact] + public void NumberToCaloriesPerCubicCentimeterDegreeCelsiusTest() => + Assert.Equal(VolumetricHeatCapacity.FromCaloriesPerCubicCentimeterDegreeCelsius(2), 2.CaloriesPerCubicCentimeterDegreeCelsius()); + + [Fact] + public void NumberToJoulesPerCubicMeterDegreeCelsiusTest() => + Assert.Equal(VolumetricHeatCapacity.FromJoulesPerCubicMeterDegreeCelsius(2), 2.JoulesPerCubicMeterDegreeCelsius()); + + [Fact] + public void NumberToJoulesPerCubicMeterKelvinTest() => + Assert.Equal(VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(2), 2.JoulesPerCubicMeterKelvin()); + + [Fact] + public void NumberToKilocaloriesPerCubicCentimeterDegreeCelsiusTest() => + Assert.Equal(VolumetricHeatCapacity.FromKilocaloriesPerCubicCentimeterDegreeCelsius(2), 2.KilocaloriesPerCubicCentimeterDegreeCelsius()); + + [Fact] + public void NumberToKilojoulesPerCubicMeterDegreeCelsiusTest() => + Assert.Equal(VolumetricHeatCapacity.FromKilojoulesPerCubicMeterDegreeCelsius(2), 2.KilojoulesPerCubicMeterDegreeCelsius()); + + [Fact] + public void NumberToKilojoulesPerCubicMeterKelvinTest() => + Assert.Equal(VolumetricHeatCapacity.FromKilojoulesPerCubicMeterKelvin(2), 2.KilojoulesPerCubicMeterKelvin()); + + [Fact] + public void NumberToMegajoulesPerCubicMeterDegreeCelsiusTest() => + Assert.Equal(VolumetricHeatCapacity.FromMegajoulesPerCubicMeterDegreeCelsius(2), 2.MegajoulesPerCubicMeterDegreeCelsius()); + + [Fact] + public void NumberToMegajoulesPerCubicMeterKelvinTest() => + Assert.Equal(VolumetricHeatCapacity.FromMegajoulesPerCubicMeterKelvin(2), 2.MegajoulesPerCubicMeterKelvin()); + + } +} diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToVolumetricHeatCapacityExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToVolumetricHeatCapacityExtensions.g.cs new file mode 100644 index 0000000000..9f3cafaa3c --- /dev/null +++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToVolumetricHeatCapacityExtensions.g.cs @@ -0,0 +1,68 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// 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; + +#nullable enable + +namespace UnitsNet.NumberExtensions.NumberToVolumetricHeatCapacity +{ + /// + /// A number to VolumetricHeatCapacity Extensions + /// + public static class NumberToVolumetricHeatCapacityExtensions + { + /// + public static VolumetricHeatCapacity BtusPerCubicFootDegreeFahrenheit(this T value) => + VolumetricHeatCapacity.FromBtusPerCubicFootDegreeFahrenheit(Convert.ToDouble(value)); + + /// + public static VolumetricHeatCapacity CaloriesPerCubicCentimeterDegreeCelsius(this T value) => + VolumetricHeatCapacity.FromCaloriesPerCubicCentimeterDegreeCelsius(Convert.ToDouble(value)); + + /// + public static VolumetricHeatCapacity JoulesPerCubicMeterDegreeCelsius(this T value) => + VolumetricHeatCapacity.FromJoulesPerCubicMeterDegreeCelsius(Convert.ToDouble(value)); + + /// + public static VolumetricHeatCapacity JoulesPerCubicMeterKelvin(this T value) => + VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(Convert.ToDouble(value)); + + /// + public static VolumetricHeatCapacity KilocaloriesPerCubicCentimeterDegreeCelsius(this T value) => + VolumetricHeatCapacity.FromKilocaloriesPerCubicCentimeterDegreeCelsius(Convert.ToDouble(value)); + + /// + public static VolumetricHeatCapacity KilojoulesPerCubicMeterDegreeCelsius(this T value) => + VolumetricHeatCapacity.FromKilojoulesPerCubicMeterDegreeCelsius(Convert.ToDouble(value)); + + /// + public static VolumetricHeatCapacity KilojoulesPerCubicMeterKelvin(this T value) => + VolumetricHeatCapacity.FromKilojoulesPerCubicMeterKelvin(Convert.ToDouble(value)); + + /// + public static VolumetricHeatCapacity MegajoulesPerCubicMeterDegreeCelsius(this T value) => + VolumetricHeatCapacity.FromMegajoulesPerCubicMeterDegreeCelsius(Convert.ToDouble(value)); + + /// + public static VolumetricHeatCapacity MegajoulesPerCubicMeterKelvin(this T value) => + VolumetricHeatCapacity.FromMegajoulesPerCubicMeterKelvin(Convert.ToDouble(value)); + + } +} diff --git a/UnitsNet.Tests/CustomCode/VolumetricHeatCapacityTests.cs b/UnitsNet.Tests/CustomCode/VolumetricHeatCapacityTests.cs new file mode 100644 index 0000000000..07ebe462ba --- /dev/null +++ b/UnitsNet.Tests/CustomCode/VolumetricHeatCapacityTests.cs @@ -0,0 +1,41 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// 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; + +namespace UnitsNet.Tests.CustomCode +{ + public class VolumetricHeatCapacityTests : VolumetricHeatCapacityTestsBase + { + protected override bool SupportsSIUnitSystem => false; + + protected override double JoulesPerCubicMeterKelvinInOneJoulePerCubicMeterKelvin => 1; + protected override double KilojoulesPerCubicMeterKelvinInOneJoulePerCubicMeterKelvin => 1E-3; + protected override double MegajoulesPerCubicMeterKelvinInOneJoulePerCubicMeterKelvin => 1E-6; + + protected override double BtusPerCubicFootDegreeFahrenheitInOneJoulePerCubicMeterKelvin => 1.491066E-5; + + protected override double CaloriesPerCubicCentimeterDegreeCelsiusInOneJoulePerCubicMeterKelvin => 2.388459E-7; + protected override double KilocaloriesPerCubicCentimeterDegreeCelsiusInOneJoulePerCubicMeterKelvin => 2.388459E-10; + + protected override double JoulesPerCubicMeterDegreeCelsiusInOneJoulePerCubicMeterKelvin => 1; + protected override double KilojoulesPerCubicMeterDegreeCelsiusInOneJoulePerCubicMeterKelvin => 1E-3; + protected override double MegajoulesPerCubicMeterDegreeCelsiusInOneJoulePerCubicMeterKelvin => 1E-6; + } +} diff --git a/UnitsNet.Tests/GeneratedCode/IQuantityTests.g.cs b/UnitsNet.Tests/GeneratedCode/IQuantityTests.g.cs index 8368feebbf..3714af6e50 100644 --- a/UnitsNet.Tests/GeneratedCode/IQuantityTests.g.cs +++ b/UnitsNet.Tests/GeneratedCode/IQuantityTests.g.cs @@ -140,6 +140,7 @@ void Assertion(int expectedValue, Enum expectedUnit, IQuantity quantity) Assertion(3, VolumeConcentrationUnit.PicolitersPerMililiter, Quantity.From(3, VolumeConcentrationUnit.PicolitersPerMililiter)); Assertion(3, VolumeFlowUnit.UsGallonPerSecond, Quantity.From(3, VolumeFlowUnit.UsGallonPerSecond)); Assertion(3, VolumePerLengthUnit.OilBarrelPerFoot, Quantity.From(3, VolumePerLengthUnit.OilBarrelPerFoot)); + Assertion(3, VolumetricHeatCapacityUnit.MegajoulePerCubicMeterKelvin, Quantity.From(3, VolumetricHeatCapacityUnit.MegajoulePerCubicMeterKelvin)); Assertion(3, WarpingMomentOfInertiaUnit.MillimeterToTheSixth, Quantity.From(3, WarpingMomentOfInertiaUnit.MillimeterToTheSixth)); } @@ -254,6 +255,7 @@ public void QuantityInfo_IsSameAsStaticInfoProperty() Assertion(VolumeConcentration.Info, VolumeConcentration.Zero); Assertion(VolumeFlow.Info, VolumeFlow.Zero); Assertion(VolumePerLength.Info, VolumePerLength.Zero); + Assertion(VolumetricHeatCapacity.Info, VolumetricHeatCapacity.Zero); Assertion(WarpingMomentOfInertia.Info, WarpingMomentOfInertia.Zero); } @@ -368,6 +370,7 @@ public void Type_EqualsStaticQuantityTypeProperty() Assertion(VolumeConcentration.QuantityType, VolumeConcentration.Zero); Assertion(VolumeFlow.QuantityType, VolumeFlow.Zero); Assertion(VolumePerLength.QuantityType, VolumePerLength.Zero); + Assertion(VolumetricHeatCapacity.QuantityType, VolumetricHeatCapacity.Zero); Assertion(WarpingMomentOfInertia.QuantityType, WarpingMomentOfInertia.Zero); } @@ -482,6 +485,7 @@ public void Dimensions_IsSameAsStaticBaseDimensions() Assertion(VolumeConcentration.BaseDimensions, VolumeConcentration.Zero); Assertion(VolumeFlow.BaseDimensions, VolumeFlow.Zero); Assertion(VolumePerLength.BaseDimensions, VolumePerLength.Zero); + Assertion(VolumetricHeatCapacity.BaseDimensions, VolumetricHeatCapacity.Zero); Assertion(WarpingMomentOfInertia.BaseDimensions, WarpingMomentOfInertia.Zero); } } diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumetricHeatCapacityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumetricHeatCapacityTestsBase.g.cs new file mode 100644 index 0000000000..8abd390f15 --- /dev/null +++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumetricHeatCapacityTestsBase.g.cs @@ -0,0 +1,698 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// 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.Globalization; +using System.Linq; +using System.Threading; +using UnitsNet.Tests.TestsBase; +using UnitsNet.Units; +using Xunit; + +// Disable build warning CS1718: Comparison made to same variable; did you mean to compare something else? +#pragma warning disable 1718 + +// ReSharper disable once CheckNamespace +namespace UnitsNet.Tests +{ + /// + /// Test of VolumetricHeatCapacity. + /// +// ReSharper disable once PartialTypeWithSinglePart + public abstract partial class VolumetricHeatCapacityTestsBase : QuantityTestsBase + { + protected abstract double BtusPerCubicFootDegreeFahrenheitInOneJoulePerCubicMeterKelvin { get; } + protected abstract double CaloriesPerCubicCentimeterDegreeCelsiusInOneJoulePerCubicMeterKelvin { get; } + protected abstract double JoulesPerCubicMeterDegreeCelsiusInOneJoulePerCubicMeterKelvin { get; } + protected abstract double JoulesPerCubicMeterKelvinInOneJoulePerCubicMeterKelvin { get; } + protected abstract double KilocaloriesPerCubicCentimeterDegreeCelsiusInOneJoulePerCubicMeterKelvin { get; } + protected abstract double KilojoulesPerCubicMeterDegreeCelsiusInOneJoulePerCubicMeterKelvin { get; } + protected abstract double KilojoulesPerCubicMeterKelvinInOneJoulePerCubicMeterKelvin { get; } + protected abstract double MegajoulesPerCubicMeterDegreeCelsiusInOneJoulePerCubicMeterKelvin { get; } + protected abstract double MegajoulesPerCubicMeterKelvinInOneJoulePerCubicMeterKelvin { get; } + +// ReSharper disable VirtualMemberNeverOverriden.Global + protected virtual double BtusPerCubicFootDegreeFahrenheitTolerance { get { return 1e-5; } } + protected virtual double CaloriesPerCubicCentimeterDegreeCelsiusTolerance { get { return 1e-5; } } + protected virtual double JoulesPerCubicMeterDegreeCelsiusTolerance { get { return 1e-5; } } + protected virtual double JoulesPerCubicMeterKelvinTolerance { get { return 1e-5; } } + protected virtual double KilocaloriesPerCubicCentimeterDegreeCelsiusTolerance { get { return 1e-5; } } + protected virtual double KilojoulesPerCubicMeterDegreeCelsiusTolerance { get { return 1e-5; } } + protected virtual double KilojoulesPerCubicMeterKelvinTolerance { get { return 1e-5; } } + protected virtual double MegajoulesPerCubicMeterDegreeCelsiusTolerance { get { return 1e-5; } } + protected virtual double MegajoulesPerCubicMeterKelvinTolerance { get { return 1e-5; } } +// ReSharper restore VirtualMemberNeverOverriden.Global + + [Fact] + public void Ctor_WithUndefinedUnit_ThrowsArgumentException() + { + Assert.Throws(() => new VolumetricHeatCapacity((double)0.0, VolumetricHeatCapacityUnit.Undefined)); + } + + [Fact] + public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit() + { + var quantity = new VolumetricHeatCapacity(); + Assert.Equal(0, quantity.Value); + Assert.Equal(VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin, quantity.Unit); + } + + + [Fact] + public void Ctor_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => new VolumetricHeatCapacity(double.PositiveInfinity, VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin)); + Assert.Throws(() => new VolumetricHeatCapacity(double.NegativeInfinity, VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin)); + } + + [Fact] + public void Ctor_WithNaNValue_ThrowsArgumentException() + { + Assert.Throws(() => new VolumetricHeatCapacity(double.NaN, VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin)); + } + + [Fact] + public void Ctor_NullAsUnitSystem_ThrowsArgumentNullException() + { + Assert.Throws(() => new VolumetricHeatCapacity(value: 1, unitSystem: null)); + } + + [Fact] + public void Ctor_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + Func TestCode = () => new VolumetricHeatCapacity(value: 1, unitSystem: UnitSystem.SI); + if (SupportsSIUnitSystem) + { + var quantity = (VolumetricHeatCapacity) TestCode(); + Assert.Equal(1, quantity.Value); + } + else + { + Assert.Throws(TestCode); + } + } + + [Fact] + public void VolumetricHeatCapacity_QuantityInfo_ReturnsQuantityInfoDescribingQuantity() + { + var quantity = new VolumetricHeatCapacity(1, VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin); + + QuantityInfo quantityInfo = quantity.QuantityInfo; + + Assert.Equal(VolumetricHeatCapacity.Zero, quantityInfo.Zero); + Assert.Equal("VolumetricHeatCapacity", quantityInfo.Name); + Assert.Equal(QuantityType.VolumetricHeatCapacity, quantityInfo.QuantityType); + + var units = EnumUtils.GetEnumValues().Except(new[] {VolumetricHeatCapacityUnit.Undefined}).ToArray(); + var unitNames = units.Select(x => x.ToString()); + + // Obsolete members + Assert.Equal(units, quantityInfo.Units); + Assert.Equal(unitNames, quantityInfo.UnitNames); + } + + [Fact] + public void JoulePerCubicMeterKelvinToVolumetricHeatCapacityUnits() + { + VolumetricHeatCapacity joulepercubicmeterkelvin = VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(1); + AssertEx.EqualTolerance(BtusPerCubicFootDegreeFahrenheitInOneJoulePerCubicMeterKelvin, joulepercubicmeterkelvin.BtusPerCubicFootDegreeFahrenheit, BtusPerCubicFootDegreeFahrenheitTolerance); + AssertEx.EqualTolerance(CaloriesPerCubicCentimeterDegreeCelsiusInOneJoulePerCubicMeterKelvin, joulepercubicmeterkelvin.CaloriesPerCubicCentimeterDegreeCelsius, CaloriesPerCubicCentimeterDegreeCelsiusTolerance); + AssertEx.EqualTolerance(JoulesPerCubicMeterDegreeCelsiusInOneJoulePerCubicMeterKelvin, joulepercubicmeterkelvin.JoulesPerCubicMeterDegreeCelsius, JoulesPerCubicMeterDegreeCelsiusTolerance); + AssertEx.EqualTolerance(JoulesPerCubicMeterKelvinInOneJoulePerCubicMeterKelvin, joulepercubicmeterkelvin.JoulesPerCubicMeterKelvin, JoulesPerCubicMeterKelvinTolerance); + AssertEx.EqualTolerance(KilocaloriesPerCubicCentimeterDegreeCelsiusInOneJoulePerCubicMeterKelvin, joulepercubicmeterkelvin.KilocaloriesPerCubicCentimeterDegreeCelsius, KilocaloriesPerCubicCentimeterDegreeCelsiusTolerance); + AssertEx.EqualTolerance(KilojoulesPerCubicMeterDegreeCelsiusInOneJoulePerCubicMeterKelvin, joulepercubicmeterkelvin.KilojoulesPerCubicMeterDegreeCelsius, KilojoulesPerCubicMeterDegreeCelsiusTolerance); + AssertEx.EqualTolerance(KilojoulesPerCubicMeterKelvinInOneJoulePerCubicMeterKelvin, joulepercubicmeterkelvin.KilojoulesPerCubicMeterKelvin, KilojoulesPerCubicMeterKelvinTolerance); + AssertEx.EqualTolerance(MegajoulesPerCubicMeterDegreeCelsiusInOneJoulePerCubicMeterKelvin, joulepercubicmeterkelvin.MegajoulesPerCubicMeterDegreeCelsius, MegajoulesPerCubicMeterDegreeCelsiusTolerance); + AssertEx.EqualTolerance(MegajoulesPerCubicMeterKelvinInOneJoulePerCubicMeterKelvin, joulepercubicmeterkelvin.MegajoulesPerCubicMeterKelvin, MegajoulesPerCubicMeterKelvinTolerance); + } + + [Fact] + public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit() + { + var quantity00 = VolumetricHeatCapacity.From(1, VolumetricHeatCapacityUnit.BtuPerCubicFootDegreeFahrenheit); + AssertEx.EqualTolerance(1, quantity00.BtusPerCubicFootDegreeFahrenheit, BtusPerCubicFootDegreeFahrenheitTolerance); + Assert.Equal(VolumetricHeatCapacityUnit.BtuPerCubicFootDegreeFahrenheit, quantity00.Unit); + + var quantity01 = VolumetricHeatCapacity.From(1, VolumetricHeatCapacityUnit.CaloriePerCubicCentimeterDegreeCelsius); + AssertEx.EqualTolerance(1, quantity01.CaloriesPerCubicCentimeterDegreeCelsius, CaloriesPerCubicCentimeterDegreeCelsiusTolerance); + Assert.Equal(VolumetricHeatCapacityUnit.CaloriePerCubicCentimeterDegreeCelsius, quantity01.Unit); + + var quantity02 = VolumetricHeatCapacity.From(1, VolumetricHeatCapacityUnit.JoulePerCubicMeterDegreeCelsius); + AssertEx.EqualTolerance(1, quantity02.JoulesPerCubicMeterDegreeCelsius, JoulesPerCubicMeterDegreeCelsiusTolerance); + Assert.Equal(VolumetricHeatCapacityUnit.JoulePerCubicMeterDegreeCelsius, quantity02.Unit); + + var quantity03 = VolumetricHeatCapacity.From(1, VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin); + AssertEx.EqualTolerance(1, quantity03.JoulesPerCubicMeterKelvin, JoulesPerCubicMeterKelvinTolerance); + Assert.Equal(VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin, quantity03.Unit); + + var quantity04 = VolumetricHeatCapacity.From(1, VolumetricHeatCapacityUnit.KilocaloriePerCubicCentimeterDegreeCelsius); + AssertEx.EqualTolerance(1, quantity04.KilocaloriesPerCubicCentimeterDegreeCelsius, KilocaloriesPerCubicCentimeterDegreeCelsiusTolerance); + Assert.Equal(VolumetricHeatCapacityUnit.KilocaloriePerCubicCentimeterDegreeCelsius, quantity04.Unit); + + var quantity05 = VolumetricHeatCapacity.From(1, VolumetricHeatCapacityUnit.KilojoulePerCubicMeterDegreeCelsius); + AssertEx.EqualTolerance(1, quantity05.KilojoulesPerCubicMeterDegreeCelsius, KilojoulesPerCubicMeterDegreeCelsiusTolerance); + Assert.Equal(VolumetricHeatCapacityUnit.KilojoulePerCubicMeterDegreeCelsius, quantity05.Unit); + + var quantity06 = VolumetricHeatCapacity.From(1, VolumetricHeatCapacityUnit.KilojoulePerCubicMeterKelvin); + AssertEx.EqualTolerance(1, quantity06.KilojoulesPerCubicMeterKelvin, KilojoulesPerCubicMeterKelvinTolerance); + Assert.Equal(VolumetricHeatCapacityUnit.KilojoulePerCubicMeterKelvin, quantity06.Unit); + + var quantity07 = VolumetricHeatCapacity.From(1, VolumetricHeatCapacityUnit.MegajoulePerCubicMeterDegreeCelsius); + AssertEx.EqualTolerance(1, quantity07.MegajoulesPerCubicMeterDegreeCelsius, MegajoulesPerCubicMeterDegreeCelsiusTolerance); + Assert.Equal(VolumetricHeatCapacityUnit.MegajoulePerCubicMeterDegreeCelsius, quantity07.Unit); + + var quantity08 = VolumetricHeatCapacity.From(1, VolumetricHeatCapacityUnit.MegajoulePerCubicMeterKelvin); + AssertEx.EqualTolerance(1, quantity08.MegajoulesPerCubicMeterKelvin, MegajoulesPerCubicMeterKelvinTolerance); + Assert.Equal(VolumetricHeatCapacityUnit.MegajoulePerCubicMeterKelvin, quantity08.Unit); + + } + + [Fact] + public void FromJoulesPerCubicMeterKelvin_WithInfinityValue_ThrowsArgumentException() + { + Assert.Throws(() => VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(double.PositiveInfinity)); + Assert.Throws(() => VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(double.NegativeInfinity)); + } + + [Fact] + public void FromJoulesPerCubicMeterKelvin_WithNanValue_ThrowsArgumentException() + { + Assert.Throws(() => VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(double.NaN)); + } + + [Fact] + public void As() + { + var joulepercubicmeterkelvin = VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(1); + AssertEx.EqualTolerance(BtusPerCubicFootDegreeFahrenheitInOneJoulePerCubicMeterKelvin, joulepercubicmeterkelvin.As(VolumetricHeatCapacityUnit.BtuPerCubicFootDegreeFahrenheit), BtusPerCubicFootDegreeFahrenheitTolerance); + AssertEx.EqualTolerance(CaloriesPerCubicCentimeterDegreeCelsiusInOneJoulePerCubicMeterKelvin, joulepercubicmeterkelvin.As(VolumetricHeatCapacityUnit.CaloriePerCubicCentimeterDegreeCelsius), CaloriesPerCubicCentimeterDegreeCelsiusTolerance); + AssertEx.EqualTolerance(JoulesPerCubicMeterDegreeCelsiusInOneJoulePerCubicMeterKelvin, joulepercubicmeterkelvin.As(VolumetricHeatCapacityUnit.JoulePerCubicMeterDegreeCelsius), JoulesPerCubicMeterDegreeCelsiusTolerance); + AssertEx.EqualTolerance(JoulesPerCubicMeterKelvinInOneJoulePerCubicMeterKelvin, joulepercubicmeterkelvin.As(VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin), JoulesPerCubicMeterKelvinTolerance); + AssertEx.EqualTolerance(KilocaloriesPerCubicCentimeterDegreeCelsiusInOneJoulePerCubicMeterKelvin, joulepercubicmeterkelvin.As(VolumetricHeatCapacityUnit.KilocaloriePerCubicCentimeterDegreeCelsius), KilocaloriesPerCubicCentimeterDegreeCelsiusTolerance); + AssertEx.EqualTolerance(KilojoulesPerCubicMeterDegreeCelsiusInOneJoulePerCubicMeterKelvin, joulepercubicmeterkelvin.As(VolumetricHeatCapacityUnit.KilojoulePerCubicMeterDegreeCelsius), KilojoulesPerCubicMeterDegreeCelsiusTolerance); + AssertEx.EqualTolerance(KilojoulesPerCubicMeterKelvinInOneJoulePerCubicMeterKelvin, joulepercubicmeterkelvin.As(VolumetricHeatCapacityUnit.KilojoulePerCubicMeterKelvin), KilojoulesPerCubicMeterKelvinTolerance); + AssertEx.EqualTolerance(MegajoulesPerCubicMeterDegreeCelsiusInOneJoulePerCubicMeterKelvin, joulepercubicmeterkelvin.As(VolumetricHeatCapacityUnit.MegajoulePerCubicMeterDegreeCelsius), MegajoulesPerCubicMeterDegreeCelsiusTolerance); + AssertEx.EqualTolerance(MegajoulesPerCubicMeterKelvinInOneJoulePerCubicMeterKelvin, joulepercubicmeterkelvin.As(VolumetricHeatCapacityUnit.MegajoulePerCubicMeterKelvin), MegajoulesPerCubicMeterKelvinTolerance); + } + + [Fact] + public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported() + { + var quantity = new VolumetricHeatCapacity(value: 1, unit: VolumetricHeatCapacity.BaseUnit); + Func AsWithSIUnitSystem = () => quantity.As(UnitSystem.SI); + + if (SupportsSIUnitSystem) + { + var value = (double) AsWithSIUnitSystem(); + Assert.Equal(1, value); + } + else + { + Assert.Throws(AsWithSIUnitSystem); + } + } + + [Fact] + public void ToUnit() + { + var joulepercubicmeterkelvin = VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(1); + + var btupercubicfootdegreefahrenheitQuantity = joulepercubicmeterkelvin.ToUnit(VolumetricHeatCapacityUnit.BtuPerCubicFootDegreeFahrenheit); + AssertEx.EqualTolerance(BtusPerCubicFootDegreeFahrenheitInOneJoulePerCubicMeterKelvin, (double)btupercubicfootdegreefahrenheitQuantity.Value, BtusPerCubicFootDegreeFahrenheitTolerance); + Assert.Equal(VolumetricHeatCapacityUnit.BtuPerCubicFootDegreeFahrenheit, btupercubicfootdegreefahrenheitQuantity.Unit); + + var caloriepercubiccentimeterdegreecelsiusQuantity = joulepercubicmeterkelvin.ToUnit(VolumetricHeatCapacityUnit.CaloriePerCubicCentimeterDegreeCelsius); + AssertEx.EqualTolerance(CaloriesPerCubicCentimeterDegreeCelsiusInOneJoulePerCubicMeterKelvin, (double)caloriepercubiccentimeterdegreecelsiusQuantity.Value, CaloriesPerCubicCentimeterDegreeCelsiusTolerance); + Assert.Equal(VolumetricHeatCapacityUnit.CaloriePerCubicCentimeterDegreeCelsius, caloriepercubiccentimeterdegreecelsiusQuantity.Unit); + + var joulepercubicmeterdegreecelsiusQuantity = joulepercubicmeterkelvin.ToUnit(VolumetricHeatCapacityUnit.JoulePerCubicMeterDegreeCelsius); + AssertEx.EqualTolerance(JoulesPerCubicMeterDegreeCelsiusInOneJoulePerCubicMeterKelvin, (double)joulepercubicmeterdegreecelsiusQuantity.Value, JoulesPerCubicMeterDegreeCelsiusTolerance); + Assert.Equal(VolumetricHeatCapacityUnit.JoulePerCubicMeterDegreeCelsius, joulepercubicmeterdegreecelsiusQuantity.Unit); + + var joulepercubicmeterkelvinQuantity = joulepercubicmeterkelvin.ToUnit(VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin); + AssertEx.EqualTolerance(JoulesPerCubicMeterKelvinInOneJoulePerCubicMeterKelvin, (double)joulepercubicmeterkelvinQuantity.Value, JoulesPerCubicMeterKelvinTolerance); + Assert.Equal(VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin, joulepercubicmeterkelvinQuantity.Unit); + + var kilocaloriepercubiccentimeterdegreecelsiusQuantity = joulepercubicmeterkelvin.ToUnit(VolumetricHeatCapacityUnit.KilocaloriePerCubicCentimeterDegreeCelsius); + AssertEx.EqualTolerance(KilocaloriesPerCubicCentimeterDegreeCelsiusInOneJoulePerCubicMeterKelvin, (double)kilocaloriepercubiccentimeterdegreecelsiusQuantity.Value, KilocaloriesPerCubicCentimeterDegreeCelsiusTolerance); + Assert.Equal(VolumetricHeatCapacityUnit.KilocaloriePerCubicCentimeterDegreeCelsius, kilocaloriepercubiccentimeterdegreecelsiusQuantity.Unit); + + var kilojoulepercubicmeterdegreecelsiusQuantity = joulepercubicmeterkelvin.ToUnit(VolumetricHeatCapacityUnit.KilojoulePerCubicMeterDegreeCelsius); + AssertEx.EqualTolerance(KilojoulesPerCubicMeterDegreeCelsiusInOneJoulePerCubicMeterKelvin, (double)kilojoulepercubicmeterdegreecelsiusQuantity.Value, KilojoulesPerCubicMeterDegreeCelsiusTolerance); + Assert.Equal(VolumetricHeatCapacityUnit.KilojoulePerCubicMeterDegreeCelsius, kilojoulepercubicmeterdegreecelsiusQuantity.Unit); + + var kilojoulepercubicmeterkelvinQuantity = joulepercubicmeterkelvin.ToUnit(VolumetricHeatCapacityUnit.KilojoulePerCubicMeterKelvin); + AssertEx.EqualTolerance(KilojoulesPerCubicMeterKelvinInOneJoulePerCubicMeterKelvin, (double)kilojoulepercubicmeterkelvinQuantity.Value, KilojoulesPerCubicMeterKelvinTolerance); + Assert.Equal(VolumetricHeatCapacityUnit.KilojoulePerCubicMeterKelvin, kilojoulepercubicmeterkelvinQuantity.Unit); + + var megajoulepercubicmeterdegreecelsiusQuantity = joulepercubicmeterkelvin.ToUnit(VolumetricHeatCapacityUnit.MegajoulePerCubicMeterDegreeCelsius); + AssertEx.EqualTolerance(MegajoulesPerCubicMeterDegreeCelsiusInOneJoulePerCubicMeterKelvin, (double)megajoulepercubicmeterdegreecelsiusQuantity.Value, MegajoulesPerCubicMeterDegreeCelsiusTolerance); + Assert.Equal(VolumetricHeatCapacityUnit.MegajoulePerCubicMeterDegreeCelsius, megajoulepercubicmeterdegreecelsiusQuantity.Unit); + + var megajoulepercubicmeterkelvinQuantity = joulepercubicmeterkelvin.ToUnit(VolumetricHeatCapacityUnit.MegajoulePerCubicMeterKelvin); + AssertEx.EqualTolerance(MegajoulesPerCubicMeterKelvinInOneJoulePerCubicMeterKelvin, (double)megajoulepercubicmeterkelvinQuantity.Value, MegajoulesPerCubicMeterKelvinTolerance); + Assert.Equal(VolumetricHeatCapacityUnit.MegajoulePerCubicMeterKelvin, megajoulepercubicmeterkelvinQuantity.Unit); + } + + [Fact] + public void ToBaseUnit_ReturnsQuantityWithBaseUnit() + { + var quantityInBaseUnit = VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(1).ToBaseUnit(); + Assert.Equal(VolumetricHeatCapacity.BaseUnit, quantityInBaseUnit.Unit); + } + + [Fact] + public void ConversionRoundTrip() + { + VolumetricHeatCapacity joulepercubicmeterkelvin = VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(1); + AssertEx.EqualTolerance(1, VolumetricHeatCapacity.FromBtusPerCubicFootDegreeFahrenheit(joulepercubicmeterkelvin.BtusPerCubicFootDegreeFahrenheit).JoulesPerCubicMeterKelvin, BtusPerCubicFootDegreeFahrenheitTolerance); + AssertEx.EqualTolerance(1, VolumetricHeatCapacity.FromCaloriesPerCubicCentimeterDegreeCelsius(joulepercubicmeterkelvin.CaloriesPerCubicCentimeterDegreeCelsius).JoulesPerCubicMeterKelvin, CaloriesPerCubicCentimeterDegreeCelsiusTolerance); + AssertEx.EqualTolerance(1, VolumetricHeatCapacity.FromJoulesPerCubicMeterDegreeCelsius(joulepercubicmeterkelvin.JoulesPerCubicMeterDegreeCelsius).JoulesPerCubicMeterKelvin, JoulesPerCubicMeterDegreeCelsiusTolerance); + AssertEx.EqualTolerance(1, VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(joulepercubicmeterkelvin.JoulesPerCubicMeterKelvin).JoulesPerCubicMeterKelvin, JoulesPerCubicMeterKelvinTolerance); + AssertEx.EqualTolerance(1, VolumetricHeatCapacity.FromKilocaloriesPerCubicCentimeterDegreeCelsius(joulepercubicmeterkelvin.KilocaloriesPerCubicCentimeterDegreeCelsius).JoulesPerCubicMeterKelvin, KilocaloriesPerCubicCentimeterDegreeCelsiusTolerance); + AssertEx.EqualTolerance(1, VolumetricHeatCapacity.FromKilojoulesPerCubicMeterDegreeCelsius(joulepercubicmeterkelvin.KilojoulesPerCubicMeterDegreeCelsius).JoulesPerCubicMeterKelvin, KilojoulesPerCubicMeterDegreeCelsiusTolerance); + AssertEx.EqualTolerance(1, VolumetricHeatCapacity.FromKilojoulesPerCubicMeterKelvin(joulepercubicmeterkelvin.KilojoulesPerCubicMeterKelvin).JoulesPerCubicMeterKelvin, KilojoulesPerCubicMeterKelvinTolerance); + AssertEx.EqualTolerance(1, VolumetricHeatCapacity.FromMegajoulesPerCubicMeterDegreeCelsius(joulepercubicmeterkelvin.MegajoulesPerCubicMeterDegreeCelsius).JoulesPerCubicMeterKelvin, MegajoulesPerCubicMeterDegreeCelsiusTolerance); + AssertEx.EqualTolerance(1, VolumetricHeatCapacity.FromMegajoulesPerCubicMeterKelvin(joulepercubicmeterkelvin.MegajoulesPerCubicMeterKelvin).JoulesPerCubicMeterKelvin, MegajoulesPerCubicMeterKelvinTolerance); + } + + [Fact] + public void ArithmeticOperators() + { + VolumetricHeatCapacity v = VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(1); + AssertEx.EqualTolerance(-1, -v.JoulesPerCubicMeterKelvin, JoulesPerCubicMeterKelvinTolerance); + AssertEx.EqualTolerance(2, (VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(3)-v).JoulesPerCubicMeterKelvin, JoulesPerCubicMeterKelvinTolerance); + AssertEx.EqualTolerance(2, (v + v).JoulesPerCubicMeterKelvin, JoulesPerCubicMeterKelvinTolerance); + AssertEx.EqualTolerance(10, (v*10).JoulesPerCubicMeterKelvin, JoulesPerCubicMeterKelvinTolerance); + AssertEx.EqualTolerance(10, (10*v).JoulesPerCubicMeterKelvin, JoulesPerCubicMeterKelvinTolerance); + AssertEx.EqualTolerance(2, (VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(10)/5).JoulesPerCubicMeterKelvin, JoulesPerCubicMeterKelvinTolerance); + AssertEx.EqualTolerance(2, VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(10)/VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(5), JoulesPerCubicMeterKelvinTolerance); + } + + [Fact] + public void ComparisonOperators() + { + VolumetricHeatCapacity oneJoulePerCubicMeterKelvin = VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(1); + VolumetricHeatCapacity twoJoulesPerCubicMeterKelvin = VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(2); + + Assert.True(oneJoulePerCubicMeterKelvin < twoJoulesPerCubicMeterKelvin); + Assert.True(oneJoulePerCubicMeterKelvin <= twoJoulesPerCubicMeterKelvin); + Assert.True(twoJoulesPerCubicMeterKelvin > oneJoulePerCubicMeterKelvin); + Assert.True(twoJoulesPerCubicMeterKelvin >= oneJoulePerCubicMeterKelvin); + + Assert.False(oneJoulePerCubicMeterKelvin > twoJoulesPerCubicMeterKelvin); + Assert.False(oneJoulePerCubicMeterKelvin >= twoJoulesPerCubicMeterKelvin); + Assert.False(twoJoulesPerCubicMeterKelvin < oneJoulePerCubicMeterKelvin); + Assert.False(twoJoulesPerCubicMeterKelvin <= oneJoulePerCubicMeterKelvin); + } + + [Fact] + public void CompareToIsImplemented() + { + VolumetricHeatCapacity joulepercubicmeterkelvin = VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(1); + Assert.Equal(0, joulepercubicmeterkelvin.CompareTo(joulepercubicmeterkelvin)); + Assert.True(joulepercubicmeterkelvin.CompareTo(VolumetricHeatCapacity.Zero) > 0); + Assert.True(VolumetricHeatCapacity.Zero.CompareTo(joulepercubicmeterkelvin) < 0); + } + + [Fact] + public void CompareToThrowsOnTypeMismatch() + { + VolumetricHeatCapacity joulepercubicmeterkelvin = VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(1); + Assert.Throws(() => joulepercubicmeterkelvin.CompareTo(new object())); + } + + [Fact] + public void CompareToThrowsOnNull() + { + VolumetricHeatCapacity joulepercubicmeterkelvin = VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(1); + Assert.Throws(() => joulepercubicmeterkelvin.CompareTo(null)); + } + + [Fact] + public void EqualityOperators() + { + var a = VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(1); + var b = VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(2); + +#pragma warning disable CS8073 +// ReSharper disable EqualExpressionComparison + + Assert.True(a == a); + Assert.False(a != a); + + Assert.True(a != b); + Assert.False(a == b); + + Assert.False(a == null); + Assert.False(null == a); + +// ReSharper restore EqualExpressionComparison +#pragma warning restore CS8073 + } + + [Fact] + public void Equals_SameType_IsImplemented() + { + var a = VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(1); + var b = VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(2); + + Assert.True(a.Equals(a)); + Assert.False(a.Equals(b)); + } + + [Fact] + public void Equals_QuantityAsObject_IsImplemented() + { + object a = VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(1); + object b = VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(2); + + Assert.True(a.Equals(a)); + Assert.False(a.Equals(b)); + Assert.False(a.Equals((object)null)); + } + + [Fact] + public void Equals_RelativeTolerance_IsImplemented() + { + var v = VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(1); + Assert.True(v.Equals(VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(1), JoulesPerCubicMeterKelvinTolerance, ComparisonType.Relative)); + Assert.False(v.Equals(VolumetricHeatCapacity.Zero, JoulesPerCubicMeterKelvinTolerance, ComparisonType.Relative)); + } + + [Fact] + public void Equals_NegativeRelativeTolerance_ThrowsArgumentOutOfRangeException() + { + var v = VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(1); + Assert.Throws(() => v.Equals(VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(1), -1, ComparisonType.Relative)); + } + + [Fact] + public void EqualsReturnsFalseOnTypeMismatch() + { + VolumetricHeatCapacity joulepercubicmeterkelvin = VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(1); + Assert.False(joulepercubicmeterkelvin.Equals(new object())); + } + + [Fact] + public void EqualsReturnsFalseOnNull() + { + VolumetricHeatCapacity joulepercubicmeterkelvin = VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(1); + Assert.False(joulepercubicmeterkelvin.Equals(null)); + } + + [Fact] + public void UnitsDoesNotContainUndefined() + { + Assert.DoesNotContain(VolumetricHeatCapacityUnit.Undefined, VolumetricHeatCapacity.Units); + } + + [Fact] + public void HasAtLeastOneAbbreviationSpecified() + { + var units = Enum.GetValues(typeof(VolumetricHeatCapacityUnit)).Cast(); + foreach(var unit in units) + { + if(unit == VolumetricHeatCapacityUnit.Undefined) + continue; + + var defaultAbbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit); + } + } + + [Fact] + public void BaseDimensionsShouldNeverBeNull() + { + Assert.False(VolumetricHeatCapacity.BaseDimensions is null); + } + + [Fact] + public void ToString_ReturnsValueAndUnitAbbreviationInCurrentCulture() + { + var prevCulture = Thread.CurrentThread.CurrentUICulture; + Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("en-US"); + try { + Assert.Equal("1 BTU/ft³·°F", new VolumetricHeatCapacity(1, VolumetricHeatCapacityUnit.BtuPerCubicFootDegreeFahrenheit).ToString()); + Assert.Equal("1 cal/cm³·°C", new VolumetricHeatCapacity(1, VolumetricHeatCapacityUnit.CaloriePerCubicCentimeterDegreeCelsius).ToString()); + Assert.Equal("1 J/m³·°C", new VolumetricHeatCapacity(1, VolumetricHeatCapacityUnit.JoulePerCubicMeterDegreeCelsius).ToString()); + Assert.Equal("1 J/m³·K", new VolumetricHeatCapacity(1, VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin).ToString()); + Assert.Equal("1 kcal/cm³·°C", new VolumetricHeatCapacity(1, VolumetricHeatCapacityUnit.KilocaloriePerCubicCentimeterDegreeCelsius).ToString()); + Assert.Equal("1 kJ/m³·°C", new VolumetricHeatCapacity(1, VolumetricHeatCapacityUnit.KilojoulePerCubicMeterDegreeCelsius).ToString()); + Assert.Equal("1 kJ/m³·K", new VolumetricHeatCapacity(1, VolumetricHeatCapacityUnit.KilojoulePerCubicMeterKelvin).ToString()); + Assert.Equal("1 MJ/m³·°C", new VolumetricHeatCapacity(1, VolumetricHeatCapacityUnit.MegajoulePerCubicMeterDegreeCelsius).ToString()); + Assert.Equal("1 MJ/m³·K", new VolumetricHeatCapacity(1, VolumetricHeatCapacityUnit.MegajoulePerCubicMeterKelvin).ToString()); + } + finally + { + Thread.CurrentThread.CurrentUICulture = prevCulture; + } + } + + [Fact] + public void ToString_WithSwedishCulture_ReturnsUnitAbbreviationForEnglishCultureSinceThereAreNoMappings() + { + // Chose this culture, because we don't currently have any abbreviations mapped for that culture and we expect the en-US to be used as fallback. + var swedishCulture = CultureInfo.GetCultureInfo("sv-SE"); + + Assert.Equal("1 BTU/ft³·°F", new VolumetricHeatCapacity(1, VolumetricHeatCapacityUnit.BtuPerCubicFootDegreeFahrenheit).ToString(swedishCulture)); + Assert.Equal("1 cal/cm³·°C", new VolumetricHeatCapacity(1, VolumetricHeatCapacityUnit.CaloriePerCubicCentimeterDegreeCelsius).ToString(swedishCulture)); + Assert.Equal("1 J/m³·°C", new VolumetricHeatCapacity(1, VolumetricHeatCapacityUnit.JoulePerCubicMeterDegreeCelsius).ToString(swedishCulture)); + Assert.Equal("1 J/m³·K", new VolumetricHeatCapacity(1, VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin).ToString(swedishCulture)); + Assert.Equal("1 kcal/cm³·°C", new VolumetricHeatCapacity(1, VolumetricHeatCapacityUnit.KilocaloriePerCubicCentimeterDegreeCelsius).ToString(swedishCulture)); + Assert.Equal("1 kJ/m³·°C", new VolumetricHeatCapacity(1, VolumetricHeatCapacityUnit.KilojoulePerCubicMeterDegreeCelsius).ToString(swedishCulture)); + Assert.Equal("1 kJ/m³·K", new VolumetricHeatCapacity(1, VolumetricHeatCapacityUnit.KilojoulePerCubicMeterKelvin).ToString(swedishCulture)); + Assert.Equal("1 MJ/m³·°C", new VolumetricHeatCapacity(1, VolumetricHeatCapacityUnit.MegajoulePerCubicMeterDegreeCelsius).ToString(swedishCulture)); + Assert.Equal("1 MJ/m³·K", new VolumetricHeatCapacity(1, VolumetricHeatCapacityUnit.MegajoulePerCubicMeterKelvin).ToString(swedishCulture)); + } + + [Fact] + public void ToString_SFormat_FormatsNumberWithGivenDigitsAfterRadixForCurrentCulture() + { + var oldCulture = CultureInfo.CurrentUICulture; + try + { + CultureInfo.CurrentUICulture = CultureInfo.InvariantCulture; + Assert.Equal("0.1 J/m³·K", new VolumetricHeatCapacity(0.123456, VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin).ToString("s1")); + Assert.Equal("0.12 J/m³·K", new VolumetricHeatCapacity(0.123456, VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin).ToString("s2")); + Assert.Equal("0.123 J/m³·K", new VolumetricHeatCapacity(0.123456, VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin).ToString("s3")); + Assert.Equal("0.1235 J/m³·K", new VolumetricHeatCapacity(0.123456, VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin).ToString("s4")); + } + finally + { + CultureInfo.CurrentUICulture = oldCulture; + } + } + + [Fact] + public void ToString_SFormatAndCulture_FormatsNumberWithGivenDigitsAfterRadixForGivenCulture() + { + var culture = CultureInfo.InvariantCulture; + Assert.Equal("0.1 J/m³·K", new VolumetricHeatCapacity(0.123456, VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin).ToString("s1", culture)); + Assert.Equal("0.12 J/m³·K", new VolumetricHeatCapacity(0.123456, VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin).ToString("s2", culture)); + Assert.Equal("0.123 J/m³·K", new VolumetricHeatCapacity(0.123456, VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin).ToString("s3", culture)); + Assert.Equal("0.1235 J/m³·K", new VolumetricHeatCapacity(0.123456, VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin).ToString("s4", culture)); + } + + + [Fact] + public void ToString_NullFormat_ThrowsArgumentNullException() + { + var quantity = VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(1.0); + Assert.Throws(() => quantity.ToString(null, null, null)); + } + + [Fact] + public void ToString_NullArgs_ThrowsArgumentNullException() + { + var quantity = VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(1.0); + Assert.Throws(() => quantity.ToString(null, "g", null)); + } + + [Fact] + public void ToString_NullProvider_EqualsCurrentUICulture() + { + var quantity = VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(1.0); + Assert.Equal(quantity.ToString(CultureInfo.CurrentUICulture, "g"), quantity.ToString(null, "g")); + } + + + [Fact] + public void Convert_ToBool_ThrowsInvalidCastException() + { + var quantity = VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(1.0); + Assert.Throws(() => Convert.ToBoolean(quantity)); + } + + [Fact] + public void Convert_ToByte_EqualsValueAsSameType() + { + var quantity = VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(1.0); + Assert.Equal((byte)quantity.Value, Convert.ToByte(quantity)); + } + + [Fact] + public void Convert_ToChar_ThrowsInvalidCastException() + { + var quantity = VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(1.0); + Assert.Throws(() => Convert.ToChar(quantity)); + } + + [Fact] + public void Convert_ToDateTime_ThrowsInvalidCastException() + { + var quantity = VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(1.0); + Assert.Throws(() => Convert.ToDateTime(quantity)); + } + + [Fact] + public void Convert_ToDecimal_EqualsValueAsSameType() + { + var quantity = VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(1.0); + Assert.Equal((decimal)quantity.Value, Convert.ToDecimal(quantity)); + } + + [Fact] + public void Convert_ToDouble_EqualsValueAsSameType() + { + var quantity = VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(1.0); + Assert.Equal((double)quantity.Value, Convert.ToDouble(quantity)); + } + + [Fact] + public void Convert_ToInt16_EqualsValueAsSameType() + { + var quantity = VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(1.0); + Assert.Equal((short)quantity.Value, Convert.ToInt16(quantity)); + } + + [Fact] + public void Convert_ToInt32_EqualsValueAsSameType() + { + var quantity = VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(1.0); + Assert.Equal((int)quantity.Value, Convert.ToInt32(quantity)); + } + + [Fact] + public void Convert_ToInt64_EqualsValueAsSameType() + { + var quantity = VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(1.0); + Assert.Equal((long)quantity.Value, Convert.ToInt64(quantity)); + } + + [Fact] + public void Convert_ToSByte_EqualsValueAsSameType() + { + var quantity = VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(1.0); + Assert.Equal((sbyte)quantity.Value, Convert.ToSByte(quantity)); + } + + [Fact] + public void Convert_ToSingle_EqualsValueAsSameType() + { + var quantity = VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(1.0); + Assert.Equal((float)quantity.Value, Convert.ToSingle(quantity)); + } + + [Fact] + public void Convert_ToString_EqualsToString() + { + var quantity = VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(1.0); + Assert.Equal(quantity.ToString(), Convert.ToString(quantity)); + } + + [Fact] + public void Convert_ToUInt16_EqualsValueAsSameType() + { + var quantity = VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(1.0); + Assert.Equal((ushort)quantity.Value, Convert.ToUInt16(quantity)); + } + + [Fact] + public void Convert_ToUInt32_EqualsValueAsSameType() + { + var quantity = VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(1.0); + Assert.Equal((uint)quantity.Value, Convert.ToUInt32(quantity)); + } + + [Fact] + public void Convert_ToUInt64_EqualsValueAsSameType() + { + var quantity = VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(1.0); + Assert.Equal((ulong)quantity.Value, Convert.ToUInt64(quantity)); + } + + [Fact] + public void Convert_ChangeType_SelfType_EqualsSelf() + { + var quantity = VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(1.0); + Assert.Equal(quantity, Convert.ChangeType(quantity, typeof(VolumetricHeatCapacity))); + } + + [Fact] + public void Convert_ChangeType_UnitType_EqualsUnit() + { + var quantity = VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(1.0); + Assert.Equal(quantity.Unit, Convert.ChangeType(quantity, typeof(VolumetricHeatCapacityUnit))); + } + + [Fact] + public void Convert_ChangeType_QuantityType_EqualsQuantityType() + { + var quantity = VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(1.0); + Assert.Equal(QuantityType.VolumetricHeatCapacity, Convert.ChangeType(quantity, typeof(QuantityType))); + } + + [Fact] + public void Convert_ChangeType_QuantityInfo_EqualsQuantityInfo() + { + var quantity = VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(1.0); + Assert.Equal(VolumetricHeatCapacity.Info, Convert.ChangeType(quantity, typeof(QuantityInfo))); + } + + [Fact] + public void Convert_ChangeType_BaseDimensions_EqualsBaseDimensions() + { + var quantity = VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(1.0); + Assert.Equal(VolumetricHeatCapacity.BaseDimensions, Convert.ChangeType(quantity, typeof(BaseDimensions))); + } + + [Fact] + public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException() + { + var quantity = VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(1.0); + Assert.Throws(() => Convert.ChangeType(quantity, typeof(QuantityFormatter))); + } + + [Fact] + public void GetHashCode_Equals() + { + var quantity = VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(1.0); + Assert.Equal(new {VolumetricHeatCapacity.Info.Name, quantity.Value, quantity.Unit}.GetHashCode(), quantity.GetHashCode()); + } + + [Theory] + [InlineData(1.0)] + [InlineData(-1.0)] + public void NegationOperator_ReturnsQuantity_WithNegatedValue(double value) + { + var quantity = VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(value); + Assert.Equal(VolumetricHeatCapacity.FromJoulesPerCubicMeterKelvin(-value), -quantity); + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs new file mode 100644 index 0000000000..a836761c8a --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs @@ -0,0 +1,719 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// 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.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.Units; +using UnitsNet.InternalHelpers; + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// The volumetric heat capacity is the amount of energy that must be added, in the form of heat, to one unit of volume of the material in order to cause an increase of one unit in its temperature. + /// + /// + /// https://en.wikipedia.org/wiki/Volumetric_heat_capacity + /// + // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components + // Public structures can't have any members other than public fields, and those fields must be value types or strings. + // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. + public sealed partial class VolumetricHeatCapacity : IQuantity + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly VolumetricHeatCapacityUnit? _unit; + + static VolumetricHeatCapacity() + { + BaseDimensions = new BaseDimensions(-1, 1, -2, 0, -1, 0, 0); + Info = new QuantityInfo(QuantityType.VolumetricHeatCapacity, Units.Cast().ToArray(), BaseUnit, Zero, BaseDimensions); + } + + /// + /// Creates the quantity with a value of 0 in the base unit JoulePerCubicMeterKelvin. + /// + /// + /// Windows Runtime Component requires a default constructor. + /// + public VolumetricHeatCapacity() + { + _value = 0; + _unit = BaseUnit; + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to construct this quantity with. + /// The unit representation to construct this quantity with. + /// Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component. + /// If value is NaN or Infinity. + private VolumetricHeatCapacity(double value, VolumetricHeatCapacityUnit unit) + { + if(unit == VolumetricHeatCapacityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(value, nameof(value)); + _unit = unit; + } + + #region Static Properties + + /// + /// Information about the quantity type, such as unit values and names. + /// + internal static QuantityInfo Info { get; } + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of VolumetricHeatCapacity, which is JoulePerCubicMeterKelvin. All conversions go via this value. + /// + public static VolumetricHeatCapacityUnit BaseUnit { get; } = VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin; + + /// + /// Represents the largest possible value of VolumetricHeatCapacity + /// + public static VolumetricHeatCapacity MaxValue { get; } = new VolumetricHeatCapacity(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of VolumetricHeatCapacity + /// + public static VolumetricHeatCapacity MinValue { get; } = new VolumetricHeatCapacity(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + public static QuantityType QuantityType { get; } = QuantityType.VolumetricHeatCapacity; + + /// + /// All units of measurement for the VolumetricHeatCapacity quantity. + /// + public static VolumetricHeatCapacityUnit[] Units { get; } = Enum.GetValues(typeof(VolumetricHeatCapacityUnit)).Cast().Except(new VolumetricHeatCapacityUnit[]{ VolumetricHeatCapacityUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit JoulePerCubicMeterKelvin. + /// + public static VolumetricHeatCapacity Zero { get; } = new VolumetricHeatCapacity(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => Convert.ToDouble(_value); + + /// + object IQuantity.Unit => Unit; + + /// + /// The unit this quantity was constructed with -or- if default ctor was used. + /// + public VolumetricHeatCapacityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + internal QuantityInfo QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => VolumetricHeatCapacity.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => VolumetricHeatCapacity.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get VolumetricHeatCapacity in BtusPerCubicFootDegreeFahrenheit. + /// + public double BtusPerCubicFootDegreeFahrenheit => As(VolumetricHeatCapacityUnit.BtuPerCubicFootDegreeFahrenheit); + + /// + /// Get VolumetricHeatCapacity in CaloriesPerCubicCentimeterDegreeCelsius. + /// + public double CaloriesPerCubicCentimeterDegreeCelsius => As(VolumetricHeatCapacityUnit.CaloriePerCubicCentimeterDegreeCelsius); + + /// + /// Get VolumetricHeatCapacity in JoulesPerCubicMeterDegreeCelsius. + /// + public double JoulesPerCubicMeterDegreeCelsius => As(VolumetricHeatCapacityUnit.JoulePerCubicMeterDegreeCelsius); + + /// + /// Get VolumetricHeatCapacity in JoulesPerCubicMeterKelvin. + /// + public double JoulesPerCubicMeterKelvin => As(VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin); + + /// + /// Get VolumetricHeatCapacity in KilocaloriesPerCubicCentimeterDegreeCelsius. + /// + public double KilocaloriesPerCubicCentimeterDegreeCelsius => As(VolumetricHeatCapacityUnit.KilocaloriePerCubicCentimeterDegreeCelsius); + + /// + /// Get VolumetricHeatCapacity in KilojoulesPerCubicMeterDegreeCelsius. + /// + public double KilojoulesPerCubicMeterDegreeCelsius => As(VolumetricHeatCapacityUnit.KilojoulePerCubicMeterDegreeCelsius); + + /// + /// Get VolumetricHeatCapacity in KilojoulesPerCubicMeterKelvin. + /// + public double KilojoulesPerCubicMeterKelvin => As(VolumetricHeatCapacityUnit.KilojoulePerCubicMeterKelvin); + + /// + /// Get VolumetricHeatCapacity in MegajoulesPerCubicMeterDegreeCelsius. + /// + public double MegajoulesPerCubicMeterDegreeCelsius => As(VolumetricHeatCapacityUnit.MegajoulePerCubicMeterDegreeCelsius); + + /// + /// Get VolumetricHeatCapacity in MegajoulesPerCubicMeterKelvin. + /// + public double MegajoulesPerCubicMeterKelvin => As(VolumetricHeatCapacityUnit.MegajoulePerCubicMeterKelvin); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(VolumetricHeatCapacityUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static string GetAbbreviation(VolumetricHeatCapacityUnit unit, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get VolumetricHeatCapacity from BtusPerCubicFootDegreeFahrenheit. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static VolumetricHeatCapacity FromBtusPerCubicFootDegreeFahrenheit(double btuspercubicfootdegreefahrenheit) + { + double value = (double) btuspercubicfootdegreefahrenheit; + return new VolumetricHeatCapacity(value, VolumetricHeatCapacityUnit.BtuPerCubicFootDegreeFahrenheit); + } + /// + /// Get VolumetricHeatCapacity from CaloriesPerCubicCentimeterDegreeCelsius. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static VolumetricHeatCapacity FromCaloriesPerCubicCentimeterDegreeCelsius(double caloriespercubiccentimeterdegreecelsius) + { + double value = (double) caloriespercubiccentimeterdegreecelsius; + return new VolumetricHeatCapacity(value, VolumetricHeatCapacityUnit.CaloriePerCubicCentimeterDegreeCelsius); + } + /// + /// Get VolumetricHeatCapacity from JoulesPerCubicMeterDegreeCelsius. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static VolumetricHeatCapacity FromJoulesPerCubicMeterDegreeCelsius(double joulespercubicmeterdegreecelsius) + { + double value = (double) joulespercubicmeterdegreecelsius; + return new VolumetricHeatCapacity(value, VolumetricHeatCapacityUnit.JoulePerCubicMeterDegreeCelsius); + } + /// + /// Get VolumetricHeatCapacity from JoulesPerCubicMeterKelvin. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static VolumetricHeatCapacity FromJoulesPerCubicMeterKelvin(double joulespercubicmeterkelvin) + { + double value = (double) joulespercubicmeterkelvin; + return new VolumetricHeatCapacity(value, VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin); + } + /// + /// Get VolumetricHeatCapacity from KilocaloriesPerCubicCentimeterDegreeCelsius. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static VolumetricHeatCapacity FromKilocaloriesPerCubicCentimeterDegreeCelsius(double kilocaloriespercubiccentimeterdegreecelsius) + { + double value = (double) kilocaloriespercubiccentimeterdegreecelsius; + return new VolumetricHeatCapacity(value, VolumetricHeatCapacityUnit.KilocaloriePerCubicCentimeterDegreeCelsius); + } + /// + /// Get VolumetricHeatCapacity from KilojoulesPerCubicMeterDegreeCelsius. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static VolumetricHeatCapacity FromKilojoulesPerCubicMeterDegreeCelsius(double kilojoulespercubicmeterdegreecelsius) + { + double value = (double) kilojoulespercubicmeterdegreecelsius; + return new VolumetricHeatCapacity(value, VolumetricHeatCapacityUnit.KilojoulePerCubicMeterDegreeCelsius); + } + /// + /// Get VolumetricHeatCapacity from KilojoulesPerCubicMeterKelvin. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static VolumetricHeatCapacity FromKilojoulesPerCubicMeterKelvin(double kilojoulespercubicmeterkelvin) + { + double value = (double) kilojoulespercubicmeterkelvin; + return new VolumetricHeatCapacity(value, VolumetricHeatCapacityUnit.KilojoulePerCubicMeterKelvin); + } + /// + /// Get VolumetricHeatCapacity from MegajoulesPerCubicMeterDegreeCelsius. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static VolumetricHeatCapacity FromMegajoulesPerCubicMeterDegreeCelsius(double megajoulespercubicmeterdegreecelsius) + { + double value = (double) megajoulespercubicmeterdegreecelsius; + return new VolumetricHeatCapacity(value, VolumetricHeatCapacityUnit.MegajoulePerCubicMeterDegreeCelsius); + } + /// + /// Get VolumetricHeatCapacity from MegajoulesPerCubicMeterKelvin. + /// + /// If value is NaN or Infinity. + [Windows.Foundation.Metadata.DefaultOverload] + public static VolumetricHeatCapacity FromMegajoulesPerCubicMeterKelvin(double megajoulespercubicmeterkelvin) + { + double value = (double) megajoulespercubicmeterkelvin; + return new VolumetricHeatCapacity(value, VolumetricHeatCapacityUnit.MegajoulePerCubicMeterKelvin); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// VolumetricHeatCapacity unit value. + // Fix name conflict with parameter "value" + [return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")] + public static VolumetricHeatCapacity From(double value, VolumetricHeatCapacityUnit fromUnit) + { + return new VolumetricHeatCapacity((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static VolumetricHeatCapacity Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static VolumetricHeatCapacity Parse(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse([CanBeNull] string str, out VolumetricHeatCapacity result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out VolumetricHeatCapacity result) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static VolumetricHeatCapacityUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static VolumetricHeatCapacityUnit ParseUnit(string str, [CanBeNull] string cultureName) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.Parse(str, provider); + } + + public static bool TryParseUnit(string str, out VolumetricHeatCapacityUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out VolumetricHeatCapacityUnit unit) + { + IFormatProvider provider = GetFormatProviderFromCultureName(cultureName); + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Equality / IComparable + + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is VolumetricHeatCapacity objVolumetricHeatCapacity)) throw new ArgumentException("Expected type VolumetricHeatCapacity.", nameof(obj)); + + return CompareTo(objVolumetricHeatCapacity); + } + + // Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods + internal int CompareTo(VolumetricHeatCapacity other) + { + return _value.CompareTo(other.AsBaseNumericType(this.Unit)); + } + + [Windows.Foundation.Metadata.DefaultOverload] + public override bool Equals(object obj) + { + if(obj is null || !(obj is VolumetricHeatCapacity objVolumetricHeatCapacity)) + return false; + + return Equals(objVolumetricHeatCapacity); + } + + public bool Equals(VolumetricHeatCapacity other) + { + return _value.Equals(other.AsBaseNumericType(this.Unit)); + } + + /// + /// + /// Compare equality to another VolumetricHeatCapacity within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(VolumetricHeatCapacity other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current VolumetricHeatCapacity. + public override int GetHashCode() + { + return new { QuantityType, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + double IQuantity.As(object unit) => As((VolumetricHeatCapacityUnit)unit); + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(VolumetricHeatCapacityUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = AsBaseNumericType(unit); + return Convert.ToDouble(converted); + } + + /// + /// Converts this VolumetricHeatCapacity to another VolumetricHeatCapacity with the unit representation . + /// + /// A VolumetricHeatCapacity with the specified unit. + public VolumetricHeatCapacity ToUnit(VolumetricHeatCapacityUnit unit) + { + var convertedValue = AsBaseNumericType(unit); + return new VolumetricHeatCapacity(convertedValue, unit); + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double AsBaseUnit() + { + switch(Unit) + { + case VolumetricHeatCapacityUnit.BtuPerCubicFootDegreeFahrenheit: return _value / 1.4910660e-5; + case VolumetricHeatCapacityUnit.CaloriePerCubicCentimeterDegreeCelsius: return _value / 2.388459e-7; + case VolumetricHeatCapacityUnit.JoulePerCubicMeterDegreeCelsius: return _value; + case VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin: return _value; + case VolumetricHeatCapacityUnit.KilocaloriePerCubicCentimeterDegreeCelsius: return (_value / 2.388459e-7) * 1e3d; + case VolumetricHeatCapacityUnit.KilojoulePerCubicMeterDegreeCelsius: return (_value) * 1e3d; + case VolumetricHeatCapacityUnit.KilojoulePerCubicMeterKelvin: return (_value) * 1e3d; + case VolumetricHeatCapacityUnit.MegajoulePerCubicMeterDegreeCelsius: return (_value) * 1e6d; + case VolumetricHeatCapacityUnit.MegajoulePerCubicMeterKelvin: return (_value) * 1e6d; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + private double AsBaseNumericType(VolumetricHeatCapacityUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = AsBaseUnit(); + + switch(unit) + { + case VolumetricHeatCapacityUnit.BtuPerCubicFootDegreeFahrenheit: return baseUnitValue * 1.4910660e-5; + case VolumetricHeatCapacityUnit.CaloriePerCubicCentimeterDegreeCelsius: return baseUnitValue * 2.388459e-7; + case VolumetricHeatCapacityUnit.JoulePerCubicMeterDegreeCelsius: return baseUnitValue; + case VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin: return baseUnitValue; + case VolumetricHeatCapacityUnit.KilocaloriePerCubicCentimeterDegreeCelsius: return (baseUnitValue * 2.388459e-7) / 1e3d; + case VolumetricHeatCapacityUnit.KilojoulePerCubicMeterDegreeCelsius: return (baseUnitValue) / 1e3d; + case VolumetricHeatCapacityUnit.KilojoulePerCubicMeterKelvin: return (baseUnitValue) / 1e3d; + case VolumetricHeatCapacityUnit.MegajoulePerCubicMeterDegreeCelsius: return (baseUnitValue) / 1e6d; + case VolumetricHeatCapacityUnit.MegajoulePerCubicMeterKelvin: return (baseUnitValue) / 1e6d; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Get default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString(null); + } + + /// + /// Get string representation of value and unit. Using two significant digits after radix. + /// + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName) + { + var provider = cultureName; + return ToString(provider, 2); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString(string cultureName, int significantDigitsAfterRadix) + { + var provider = cultureName; + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implicitly included as arguments 0 and 1. + /// String representation. + /// Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to if null. + public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args) + { + var provider = GetFormatProviderFromCultureName(cultureName); + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? GlobalConfiguration.DefaultCulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + #endregion + + private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName) + { + return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null; + } + } +} diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantity.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantity.g.cs index fe6e55bd3f..ab3efa0904 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantity.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantity.g.cs @@ -359,6 +359,9 @@ internal static bool TryFrom(double value, Enum unit, out IQuantity quantity) case VolumePerLengthUnit volumePerLengthUnit: quantity = VolumePerLength.From(value, volumePerLengthUnit); return true; + case VolumetricHeatCapacityUnit volumetricHeatCapacityUnit: + quantity = VolumetricHeatCapacity.From(value, volumetricHeatCapacityUnit); + return true; case WarpingMomentOfInertiaUnit warpingMomentOfInertiaUnit: quantity = WarpingMomentOfInertia.From(value, warpingMomentOfInertiaUnit); return true; @@ -730,6 +733,9 @@ internal static bool TryParse([CanBeNull] IFormatProvider formatProvider, Type q if (quantityType == typeof(VolumePerLength)) return parser.TryParse(quantityString, formatProvider, VolumePerLength.From, out quantity); + if (quantityType == typeof(VolumetricHeatCapacity)) + return parser.TryParse(quantityString, formatProvider, VolumetricHeatCapacity.From, out quantity); + if (quantityType == typeof(WarpingMomentOfInertia)) return parser.TryParse(quantityString, formatProvider, WarpingMomentOfInertia.From, out quantity); diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/QuantityType.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/QuantityType.g.cs index b0e71f175c..74594c38ac 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/QuantityType.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/QuantityType.g.cs @@ -135,6 +135,7 @@ public enum QuantityType VolumeConcentration, VolumeFlow, VolumePerLength, + VolumetricHeatCapacity, WarpingMomentOfInertia, } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/UnitAbbreviationsCache.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/UnitAbbreviationsCache.g.cs index 2481c9eb55..2da8980d4a 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/UnitAbbreviationsCache.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/UnitAbbreviationsCache.g.cs @@ -1678,6 +1678,15 @@ private static readonly (string CultureName, Type UnitType, int UnitValue, strin ("en-US", typeof(VolumePerLengthUnit), (int)VolumePerLengthUnit.LiterPerMeter, new string[]{"l/m"}), ("en-US", typeof(VolumePerLengthUnit), (int)VolumePerLengthUnit.LiterPerMillimeter, new string[]{"l/mm"}), ("en-US", typeof(VolumePerLengthUnit), (int)VolumePerLengthUnit.OilBarrelPerFoot, new string[]{"bbl/ft"}), + ("en-US", typeof(VolumetricHeatCapacityUnit), (int)VolumetricHeatCapacityUnit.BtuPerCubicFootDegreeFahrenheit, new string[]{"BTU/ft³·°F"}), + ("en-US", typeof(VolumetricHeatCapacityUnit), (int)VolumetricHeatCapacityUnit.CaloriePerCubicCentimeterDegreeCelsius, new string[]{"cal/cm³·°C"}), + ("en-US", typeof(VolumetricHeatCapacityUnit), (int)VolumetricHeatCapacityUnit.JoulePerCubicMeterDegreeCelsius, new string[]{"J/m³·°C"}), + ("en-US", typeof(VolumetricHeatCapacityUnit), (int)VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin, new string[]{"J/m³·K"}), + ("en-US", typeof(VolumetricHeatCapacityUnit), (int)VolumetricHeatCapacityUnit.KilocaloriePerCubicCentimeterDegreeCelsius, new string[]{"kcal/cm³·°C"}), + ("en-US", typeof(VolumetricHeatCapacityUnit), (int)VolumetricHeatCapacityUnit.KilojoulePerCubicMeterDegreeCelsius, new string[]{"kJ/m³·°C"}), + ("en-US", typeof(VolumetricHeatCapacityUnit), (int)VolumetricHeatCapacityUnit.KilojoulePerCubicMeterKelvin, new string[]{"kJ/m³·K"}), + ("en-US", typeof(VolumetricHeatCapacityUnit), (int)VolumetricHeatCapacityUnit.MegajoulePerCubicMeterDegreeCelsius, new string[]{"MJ/m³·°C"}), + ("en-US", typeof(VolumetricHeatCapacityUnit), (int)VolumetricHeatCapacityUnit.MegajoulePerCubicMeterKelvin, new string[]{"MJ/m³·K"}), ("en-US", typeof(WarpingMomentOfInertiaUnit), (int)WarpingMomentOfInertiaUnit.CentimeterToTheSixth, new string[]{"cm⁶", "cm^6"}), ("en-US", typeof(WarpingMomentOfInertiaUnit), (int)WarpingMomentOfInertiaUnit.DecimeterToTheSixth, new string[]{"dm⁶", "dm^6"}), ("en-US", typeof(WarpingMomentOfInertiaUnit), (int)WarpingMomentOfInertiaUnit.FootToTheSixth, new string[]{"ft⁶", "ft^6"}), diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Units/VolumetricHeatCapacityUnit.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Units/VolumetricHeatCapacityUnit.g.cs new file mode 100644 index 0000000000..2f18602337 --- /dev/null +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/Units/VolumetricHeatCapacityUnit.g.cs @@ -0,0 +1,41 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// 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. + +// ReSharper disable once CheckNamespace +namespace UnitsNet.Units +{ + // Disable missing XML comment warnings for the generated unit enums. + #pragma warning disable 1591 + + public enum VolumetricHeatCapacityUnit + { + Undefined = 0, + BtuPerCubicFootDegreeFahrenheit, + CaloriePerCubicCentimeterDegreeCelsius, + JoulePerCubicMeterDegreeCelsius, + JoulePerCubicMeterKelvin, + KilocaloriePerCubicCentimeterDegreeCelsius, + KilojoulePerCubicMeterDegreeCelsius, + KilojoulePerCubicMeterKelvin, + MegajoulePerCubicMeterDegreeCelsius, + MegajoulePerCubicMeterKelvin, + } + + #pragma warning restore 1591 +} diff --git a/UnitsNet/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs new file mode 100644 index 0000000000..b1e1ffd9e4 --- /dev/null +++ b/UnitsNet/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs @@ -0,0 +1,996 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// 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.Globalization; +using System.Linq; +using JetBrains.Annotations; +using UnitsNet.InternalHelpers; +using UnitsNet.Units; + +#nullable enable + +// ReSharper disable once CheckNamespace + +namespace UnitsNet +{ + /// + /// + /// The volumetric heat capacity is the amount of energy that must be added, in the form of heat, to one unit of volume of the material in order to cause an increase of one unit in its temperature. + /// + /// + /// https://en.wikipedia.org/wiki/Volumetric_heat_capacity + /// + public partial struct VolumetricHeatCapacity : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + { + /// + /// The numeric value this quantity was constructed with. + /// + private readonly double _value; + + /// + /// The unit this quantity was constructed with. + /// + private readonly VolumetricHeatCapacityUnit? _unit; + + static VolumetricHeatCapacity() + { + BaseDimensions = new BaseDimensions(-1, 1, -2, 0, -1, 0, 0); + + Info = new QuantityInfo("VolumetricHeatCapacity", + new UnitInfo[] { + new UnitInfo(VolumetricHeatCapacityUnit.BtuPerCubicFootDegreeFahrenheit, BaseUnits.Undefined), + new UnitInfo(VolumetricHeatCapacityUnit.CaloriePerCubicCentimeterDegreeCelsius, BaseUnits.Undefined), + new UnitInfo(VolumetricHeatCapacityUnit.JoulePerCubicMeterDegreeCelsius, BaseUnits.Undefined), + new UnitInfo(VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin, BaseUnits.Undefined), + new UnitInfo(VolumetricHeatCapacityUnit.KilocaloriePerCubicCentimeterDegreeCelsius, BaseUnits.Undefined), + new UnitInfo(VolumetricHeatCapacityUnit.KilojoulePerCubicMeterDegreeCelsius, BaseUnits.Undefined), + new UnitInfo(VolumetricHeatCapacityUnit.KilojoulePerCubicMeterKelvin, BaseUnits.Undefined), + new UnitInfo(VolumetricHeatCapacityUnit.MegajoulePerCubicMeterDegreeCelsius, BaseUnits.Undefined), + new UnitInfo(VolumetricHeatCapacityUnit.MegajoulePerCubicMeterKelvin, BaseUnits.Undefined), + }, + BaseUnit, Zero, BaseDimensions, QuantityType.VolumetricHeatCapacity); + } + + /// + /// Creates the quantity with the given numeric value and unit. + /// + /// The numeric value to construct this quantity with. + /// The unit representation to construct this quantity with. + /// If value is NaN or Infinity. + public VolumetricHeatCapacity(double value, VolumetricHeatCapacityUnit unit) + { + if(unit == VolumetricHeatCapacityUnit.Undefined) + throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit)); + + _value = Guard.EnsureValidNumber(value, nameof(value)); + _unit = unit; + } + + /// + /// Creates an instance of the quantity with the given numeric value in units compatible with the given . + /// If multiple compatible units were found, the first match is used. + /// + /// The numeric value to construct this quantity with. + /// The unit system to create the quantity with. + /// The given is null. + /// No unit was found for the given . + public VolumetricHeatCapacity(double value, UnitSystem unitSystem) + { + if(unitSystem is null) throw new ArgumentNullException(nameof(unitSystem)); + + var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); + var firstUnitInfo = unitInfos.FirstOrDefault(); + + _value = Guard.EnsureValidNumber(value, nameof(value)); + _unit = firstUnitInfo?.Value ?? throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); + } + + #region Static Properties + + /// + public static QuantityInfo Info { get; } + + /// + /// The of this quantity. + /// + public static BaseDimensions BaseDimensions { get; } + + /// + /// The base unit of VolumetricHeatCapacity, which is JoulePerCubicMeterKelvin. All conversions go via this value. + /// + public static VolumetricHeatCapacityUnit BaseUnit { get; } = VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin; + + /// + /// Represents the largest possible value of VolumetricHeatCapacity + /// + [Obsolete("MaxValue and MinValue will be removed. Choose your own value or use nullability for unbounded lower/upper range checks. See discussion in https://github.com/angularsen/UnitsNet/issues/848.")] + public static VolumetricHeatCapacity MaxValue { get; } = new VolumetricHeatCapacity(double.MaxValue, BaseUnit); + + /// + /// Represents the smallest possible value of VolumetricHeatCapacity + /// + [Obsolete("MaxValue and MinValue will be removed. Choose your own value or use nullability for unbounded lower/upper range checks. See discussion in https://github.com/angularsen/UnitsNet/issues/848.")] + public static VolumetricHeatCapacity MinValue { get; } = new VolumetricHeatCapacity(double.MinValue, BaseUnit); + + /// + /// The of this quantity. + /// + [Obsolete("QuantityType will be removed in the future. Use Info property instead.")] + public static QuantityType QuantityType { get; } = QuantityType.VolumetricHeatCapacity; + + /// + /// All units of measurement for the VolumetricHeatCapacity quantity. + /// + public static VolumetricHeatCapacityUnit[] Units { get; } = Enum.GetValues(typeof(VolumetricHeatCapacityUnit)).Cast().Except(new VolumetricHeatCapacityUnit[]{ VolumetricHeatCapacityUnit.Undefined }).ToArray(); + + /// + /// Gets an instance of this quantity with a value of 0 in the base unit JoulePerCubicMeterKelvin. + /// + public static VolumetricHeatCapacity Zero { get; } = new VolumetricHeatCapacity(0, BaseUnit); + + #endregion + + #region Properties + + /// + /// The numeric value this quantity was constructed with. + /// + public double Value => _value; + + Enum IQuantity.Unit => Unit; + + /// + public VolumetricHeatCapacityUnit Unit => _unit.GetValueOrDefault(BaseUnit); + + /// + public QuantityInfo QuantityInfo => Info; + + /// + QuantityInfo IQuantity.QuantityInfo => Info; + + /// + /// The of this quantity. + /// + public QuantityType Type => VolumetricHeatCapacity.QuantityType; + + /// + /// The of this quantity. + /// + public BaseDimensions Dimensions => VolumetricHeatCapacity.BaseDimensions; + + #endregion + + #region Conversion Properties + + /// + /// Get VolumetricHeatCapacity in BtusPerCubicFootDegreeFahrenheit. + /// + public double BtusPerCubicFootDegreeFahrenheit => As(VolumetricHeatCapacityUnit.BtuPerCubicFootDegreeFahrenheit); + + /// + /// Get VolumetricHeatCapacity in CaloriesPerCubicCentimeterDegreeCelsius. + /// + public double CaloriesPerCubicCentimeterDegreeCelsius => As(VolumetricHeatCapacityUnit.CaloriePerCubicCentimeterDegreeCelsius); + + /// + /// Get VolumetricHeatCapacity in JoulesPerCubicMeterDegreeCelsius. + /// + public double JoulesPerCubicMeterDegreeCelsius => As(VolumetricHeatCapacityUnit.JoulePerCubicMeterDegreeCelsius); + + /// + /// Get VolumetricHeatCapacity in JoulesPerCubicMeterKelvin. + /// + public double JoulesPerCubicMeterKelvin => As(VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin); + + /// + /// Get VolumetricHeatCapacity in KilocaloriesPerCubicCentimeterDegreeCelsius. + /// + public double KilocaloriesPerCubicCentimeterDegreeCelsius => As(VolumetricHeatCapacityUnit.KilocaloriePerCubicCentimeterDegreeCelsius); + + /// + /// Get VolumetricHeatCapacity in KilojoulesPerCubicMeterDegreeCelsius. + /// + public double KilojoulesPerCubicMeterDegreeCelsius => As(VolumetricHeatCapacityUnit.KilojoulePerCubicMeterDegreeCelsius); + + /// + /// Get VolumetricHeatCapacity in KilojoulesPerCubicMeterKelvin. + /// + public double KilojoulesPerCubicMeterKelvin => As(VolumetricHeatCapacityUnit.KilojoulePerCubicMeterKelvin); + + /// + /// Get VolumetricHeatCapacity in MegajoulesPerCubicMeterDegreeCelsius. + /// + public double MegajoulesPerCubicMeterDegreeCelsius => As(VolumetricHeatCapacityUnit.MegajoulePerCubicMeterDegreeCelsius); + + /// + /// Get VolumetricHeatCapacity in MegajoulesPerCubicMeterKelvin. + /// + public double MegajoulesPerCubicMeterKelvin => As(VolumetricHeatCapacityUnit.MegajoulePerCubicMeterKelvin); + + #endregion + + #region Static Methods + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + public static string GetAbbreviation(VolumetricHeatCapacityUnit unit) + { + return GetAbbreviation(unit, null); + } + + /// + /// Get unit abbreviation string. + /// + /// Unit to get abbreviation for. + /// Unit abbreviation string. + /// Format to use for localization. Defaults to if null. + public static string GetAbbreviation(VolumetricHeatCapacityUnit unit, IFormatProvider? provider) + { + return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider); + } + + #endregion + + #region Static Factory Methods + + /// + /// Get VolumetricHeatCapacity from BtusPerCubicFootDegreeFahrenheit. + /// + /// If value is NaN or Infinity. + public static VolumetricHeatCapacity FromBtusPerCubicFootDegreeFahrenheit(QuantityValue btuspercubicfootdegreefahrenheit) + { + double value = (double) btuspercubicfootdegreefahrenheit; + return new VolumetricHeatCapacity(value, VolumetricHeatCapacityUnit.BtuPerCubicFootDegreeFahrenheit); + } + /// + /// Get VolumetricHeatCapacity from CaloriesPerCubicCentimeterDegreeCelsius. + /// + /// If value is NaN or Infinity. + public static VolumetricHeatCapacity FromCaloriesPerCubicCentimeterDegreeCelsius(QuantityValue caloriespercubiccentimeterdegreecelsius) + { + double value = (double) caloriespercubiccentimeterdegreecelsius; + return new VolumetricHeatCapacity(value, VolumetricHeatCapacityUnit.CaloriePerCubicCentimeterDegreeCelsius); + } + /// + /// Get VolumetricHeatCapacity from JoulesPerCubicMeterDegreeCelsius. + /// + /// If value is NaN or Infinity. + public static VolumetricHeatCapacity FromJoulesPerCubicMeterDegreeCelsius(QuantityValue joulespercubicmeterdegreecelsius) + { + double value = (double) joulespercubicmeterdegreecelsius; + return new VolumetricHeatCapacity(value, VolumetricHeatCapacityUnit.JoulePerCubicMeterDegreeCelsius); + } + /// + /// Get VolumetricHeatCapacity from JoulesPerCubicMeterKelvin. + /// + /// If value is NaN or Infinity. + public static VolumetricHeatCapacity FromJoulesPerCubicMeterKelvin(QuantityValue joulespercubicmeterkelvin) + { + double value = (double) joulespercubicmeterkelvin; + return new VolumetricHeatCapacity(value, VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin); + } + /// + /// Get VolumetricHeatCapacity from KilocaloriesPerCubicCentimeterDegreeCelsius. + /// + /// If value is NaN or Infinity. + public static VolumetricHeatCapacity FromKilocaloriesPerCubicCentimeterDegreeCelsius(QuantityValue kilocaloriespercubiccentimeterdegreecelsius) + { + double value = (double) kilocaloriespercubiccentimeterdegreecelsius; + return new VolumetricHeatCapacity(value, VolumetricHeatCapacityUnit.KilocaloriePerCubicCentimeterDegreeCelsius); + } + /// + /// Get VolumetricHeatCapacity from KilojoulesPerCubicMeterDegreeCelsius. + /// + /// If value is NaN or Infinity. + public static VolumetricHeatCapacity FromKilojoulesPerCubicMeterDegreeCelsius(QuantityValue kilojoulespercubicmeterdegreecelsius) + { + double value = (double) kilojoulespercubicmeterdegreecelsius; + return new VolumetricHeatCapacity(value, VolumetricHeatCapacityUnit.KilojoulePerCubicMeterDegreeCelsius); + } + /// + /// Get VolumetricHeatCapacity from KilojoulesPerCubicMeterKelvin. + /// + /// If value is NaN or Infinity. + public static VolumetricHeatCapacity FromKilojoulesPerCubicMeterKelvin(QuantityValue kilojoulespercubicmeterkelvin) + { + double value = (double) kilojoulespercubicmeterkelvin; + return new VolumetricHeatCapacity(value, VolumetricHeatCapacityUnit.KilojoulePerCubicMeterKelvin); + } + /// + /// Get VolumetricHeatCapacity from MegajoulesPerCubicMeterDegreeCelsius. + /// + /// If value is NaN or Infinity. + public static VolumetricHeatCapacity FromMegajoulesPerCubicMeterDegreeCelsius(QuantityValue megajoulespercubicmeterdegreecelsius) + { + double value = (double) megajoulespercubicmeterdegreecelsius; + return new VolumetricHeatCapacity(value, VolumetricHeatCapacityUnit.MegajoulePerCubicMeterDegreeCelsius); + } + /// + /// Get VolumetricHeatCapacity from MegajoulesPerCubicMeterKelvin. + /// + /// If value is NaN or Infinity. + public static VolumetricHeatCapacity FromMegajoulesPerCubicMeterKelvin(QuantityValue megajoulespercubicmeterkelvin) + { + double value = (double) megajoulespercubicmeterkelvin; + return new VolumetricHeatCapacity(value, VolumetricHeatCapacityUnit.MegajoulePerCubicMeterKelvin); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// VolumetricHeatCapacity unit value. + public static VolumetricHeatCapacity From(QuantityValue value, VolumetricHeatCapacityUnit fromUnit) + { + return new VolumetricHeatCapacity((double)value, fromUnit); + } + + #endregion + + #region Static Parse Methods + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + public static VolumetricHeatCapacity Parse(string str) + { + return Parse(str, null); + } + + /// + /// Parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// + /// Expected string to have one or two pairs of quantity and unit in the format + /// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in" + /// + /// + /// More than one unit is represented by the specified unit abbreviation. + /// Example: Volume.Parse("1 cup") will throw, because it can refer to any of + /// , and . + /// + /// + /// If anything else goes wrong, typically due to a bug or unhandled case. + /// We wrap exceptions in to allow you to distinguish + /// Units.NET exceptions from other exceptions. + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static VolumetricHeatCapacity Parse(string str, IFormatProvider? provider) + { + return QuantityParser.Default.Parse( + str, + provider, + From); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + public static bool TryParse(string? str, out VolumetricHeatCapacity result) + { + return TryParse(str, null, out result); + } + + /// + /// Try to parse a string with one or two quantities of the format "<quantity> <unit>". + /// + /// String to parse. Typically in the form: {number} {unit} + /// Resulting unit quantity if successful. + /// True if successful, otherwise false. + /// + /// Length.Parse("5.5 m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParse(string? str, IFormatProvider? provider, out VolumetricHeatCapacity result) + { + return QuantityParser.Default.TryParse( + str, + provider, + From, + out result); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static VolumetricHeatCapacityUnit ParseUnit(string str) + { + return ParseUnit(str, null); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// Format to use when parsing number and unit. Defaults to if null. + /// + /// Length.ParseUnit("m", new CultureInfo("en-US")); + /// + /// The value of 'str' cannot be null. + /// Error parsing string. + public static VolumetricHeatCapacityUnit ParseUnit(string str, IFormatProvider? provider) + { + return UnitParser.Default.Parse(str, provider); + } + + /// + public static bool TryParseUnit(string str, out VolumetricHeatCapacityUnit unit) + { + return TryParseUnit(str, null, out unit); + } + + /// + /// Parse a unit string. + /// + /// String to parse. Typically in the form: {number} {unit} + /// The parsed unit if successful. + /// True if successful, otherwise false. + /// + /// Length.TryParseUnit("m", new CultureInfo("en-US")); + /// + /// Format to use when parsing number and unit. Defaults to if null. + public static bool TryParseUnit(string str, IFormatProvider? provider, out VolumetricHeatCapacityUnit unit) + { + return UnitParser.Default.TryParse(str, provider, out unit); + } + + #endregion + + #region Arithmetic Operators + + /// Negate the value. + public static VolumetricHeatCapacity operator -(VolumetricHeatCapacity right) + { + return new VolumetricHeatCapacity(-right.Value, right.Unit); + } + + /// Get from adding two . + public static VolumetricHeatCapacity operator +(VolumetricHeatCapacity left, VolumetricHeatCapacity right) + { + return new VolumetricHeatCapacity(left.Value + right.GetValueAs(left.Unit), left.Unit); + } + + /// Get from subtracting two . + public static VolumetricHeatCapacity operator -(VolumetricHeatCapacity left, VolumetricHeatCapacity right) + { + return new VolumetricHeatCapacity(left.Value - right.GetValueAs(left.Unit), left.Unit); + } + + /// Get from multiplying value and . + public static VolumetricHeatCapacity operator *(double left, VolumetricHeatCapacity right) + { + return new VolumetricHeatCapacity(left * right.Value, right.Unit); + } + + /// Get from multiplying value and . + public static VolumetricHeatCapacity operator *(VolumetricHeatCapacity left, double right) + { + return new VolumetricHeatCapacity(left.Value * right, left.Unit); + } + + /// Get from dividing by value. + public static VolumetricHeatCapacity operator /(VolumetricHeatCapacity left, double right) + { + return new VolumetricHeatCapacity(left.Value / right, left.Unit); + } + + /// Get ratio value from dividing by . + public static double operator /(VolumetricHeatCapacity left, VolumetricHeatCapacity right) + { + return left.JoulesPerCubicMeterKelvin / right.JoulesPerCubicMeterKelvin; + } + + #endregion + + #region Equality / IComparable + + /// Returns true if less or equal to. + public static bool operator <=(VolumetricHeatCapacity left, VolumetricHeatCapacity right) + { + return left.Value <= right.GetValueAs(left.Unit); + } + + /// Returns true if greater than or equal to. + public static bool operator >=(VolumetricHeatCapacity left, VolumetricHeatCapacity right) + { + return left.Value >= right.GetValueAs(left.Unit); + } + + /// Returns true if less than. + public static bool operator <(VolumetricHeatCapacity left, VolumetricHeatCapacity right) + { + return left.Value < right.GetValueAs(left.Unit); + } + + /// Returns true if greater than. + public static bool operator >(VolumetricHeatCapacity left, VolumetricHeatCapacity right) + { + return left.Value > right.GetValueAs(left.Unit); + } + + /// Returns true if exactly equal. + /// Consider using for safely comparing floating point values. + public static bool operator ==(VolumetricHeatCapacity left, VolumetricHeatCapacity right) + { + return left.Equals(right); + } + + /// Returns true if not exactly equal. + /// Consider using for safely comparing floating point values. + public static bool operator !=(VolumetricHeatCapacity left, VolumetricHeatCapacity right) + { + return !(left == right); + } + + /// + public int CompareTo(object obj) + { + if(obj is null) throw new ArgumentNullException(nameof(obj)); + if(!(obj is VolumetricHeatCapacity objVolumetricHeatCapacity)) throw new ArgumentException("Expected type VolumetricHeatCapacity.", nameof(obj)); + + return CompareTo(objVolumetricHeatCapacity); + } + + /// + public int CompareTo(VolumetricHeatCapacity other) + { + return _value.CompareTo(other.GetValueAs(this.Unit)); + } + + /// + /// Consider using for safely comparing floating point values. + public override bool Equals(object obj) + { + if(obj is null || !(obj is VolumetricHeatCapacity objVolumetricHeatCapacity)) + return false; + + return Equals(objVolumetricHeatCapacity); + } + + /// + /// Consider using for safely comparing floating point values. + public bool Equals(VolumetricHeatCapacity other) + { + return _value.Equals(other.GetValueAs(this.Unit)); + } + + /// + /// + /// Compare equality to another VolumetricHeatCapacity within the given absolute or relative tolerance. + /// + /// + /// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a percentage of this quantity's value. will be converted into + /// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of + /// this quantity's value to be considered equal. + /// + /// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Relative); + /// + /// + /// + /// + /// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and + /// as a fixed number in this quantity's unit. will be converted into + /// this quantity's unit for comparison. + /// + /// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm). + /// + /// var a = Length.FromMeters(2.0); + /// var b = Length.FromInches(50.0); + /// a.Equals(b, 0.01, ComparisonType.Absolute); + /// + /// + /// + /// + /// Note that it is advised against specifying zero difference, due to the nature + /// of floating point operations and using System.Double internally. + /// + /// + /// The other quantity to compare to. + /// The absolute or relative tolerance value. Must be greater than or equal to 0. + /// The comparison type: either relative or absolute. + /// True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance. + public bool Equals(VolumetricHeatCapacity other, double tolerance, ComparisonType comparisonType) + { + if(tolerance < 0) + throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0."); + + double thisValue = (double)this.Value; + double otherValueInThisUnits = other.As(this.Unit); + + return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType); + } + + /// + /// Returns the hash code for this instance. + /// + /// A hash code for the current VolumetricHeatCapacity. + public override int GetHashCode() + { + return new { Info.Name, Value, Unit }.GetHashCode(); + } + + #endregion + + #region Conversion Methods + + /// + /// Convert to the unit representation . + /// + /// Value converted to the specified unit. + public double As(VolumetricHeatCapacityUnit unit) + { + if(Unit == unit) + return Convert.ToDouble(Value); + + var converted = GetValueAs(unit); + return Convert.ToDouble(converted); + } + + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem is null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); + + var firstUnitInfo = unitInfos.FirstOrDefault(); + if(firstUnitInfo == null) + throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); + + return As(firstUnitInfo.Value); + } + + /// + double IQuantity.As(Enum unit) + { + if(!(unit is VolumetricHeatCapacityUnit unitAsVolumetricHeatCapacityUnit)) + throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(VolumetricHeatCapacityUnit)} is supported.", nameof(unit)); + + return As(unitAsVolumetricHeatCapacityUnit); + } + + /// + /// Converts this VolumetricHeatCapacity to another VolumetricHeatCapacity with the unit representation . + /// + /// A VolumetricHeatCapacity with the specified unit. + public VolumetricHeatCapacity ToUnit(VolumetricHeatCapacityUnit unit) + { + var convertedValue = GetValueAs(unit); + return new VolumetricHeatCapacity(convertedValue, unit); + } + + /// + IQuantity IQuantity.ToUnit(Enum unit) + { + if(!(unit is VolumetricHeatCapacityUnit unitAsVolumetricHeatCapacityUnit)) + throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(VolumetricHeatCapacityUnit)} is supported.", nameof(unit)); + + return ToUnit(unitAsVolumetricHeatCapacityUnit); + } + + /// + public VolumetricHeatCapacity ToUnit(UnitSystem unitSystem) + { + if(unitSystem is null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitInfos = Info.GetUnitInfosFor(unitSystem.BaseUnits); + + var firstUnitInfo = unitInfos.FirstOrDefault(); + if(firstUnitInfo == null) + throw new ArgumentException("No units were found for the given UnitSystem.", nameof(unitSystem)); + + return ToUnit(firstUnitInfo.Value); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + + /// + IQuantity IQuantity.ToUnit(VolumetricHeatCapacityUnit unit) => ToUnit(unit); + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + private double GetValueInBaseUnit() + { + switch(Unit) + { + case VolumetricHeatCapacityUnit.BtuPerCubicFootDegreeFahrenheit: return _value / 1.4910660e-5; + case VolumetricHeatCapacityUnit.CaloriePerCubicCentimeterDegreeCelsius: return _value / 2.388459e-7; + case VolumetricHeatCapacityUnit.JoulePerCubicMeterDegreeCelsius: return _value; + case VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin: return _value; + case VolumetricHeatCapacityUnit.KilocaloriePerCubicCentimeterDegreeCelsius: return (_value / 2.388459e-7) * 1e3d; + case VolumetricHeatCapacityUnit.KilojoulePerCubicMeterDegreeCelsius: return (_value) * 1e3d; + case VolumetricHeatCapacityUnit.KilojoulePerCubicMeterKelvin: return (_value) * 1e3d; + case VolumetricHeatCapacityUnit.MegajoulePerCubicMeterDegreeCelsius: return (_value) * 1e6d; + case VolumetricHeatCapacityUnit.MegajoulePerCubicMeterKelvin: return (_value) * 1e6d; + default: + throw new NotImplementedException($"Can not convert {Unit} to base units."); + } + } + + /// + /// Converts the current value + unit to the base unit. + /// This is typically the first step in converting from one unit to another. + /// + /// The value in the base unit representation. + internal VolumetricHeatCapacity ToBaseUnit() + { + var baseUnitValue = GetValueInBaseUnit(); + return new VolumetricHeatCapacity(baseUnitValue, BaseUnit); + } + + private double GetValueAs(VolumetricHeatCapacityUnit unit) + { + if(Unit == unit) + return _value; + + var baseUnitValue = GetValueInBaseUnit(); + + switch(unit) + { + case VolumetricHeatCapacityUnit.BtuPerCubicFootDegreeFahrenheit: return baseUnitValue * 1.4910660e-5; + case VolumetricHeatCapacityUnit.CaloriePerCubicCentimeterDegreeCelsius: return baseUnitValue * 2.388459e-7; + case VolumetricHeatCapacityUnit.JoulePerCubicMeterDegreeCelsius: return baseUnitValue; + case VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin: return baseUnitValue; + case VolumetricHeatCapacityUnit.KilocaloriePerCubicCentimeterDegreeCelsius: return (baseUnitValue * 2.388459e-7) / 1e3d; + case VolumetricHeatCapacityUnit.KilojoulePerCubicMeterDegreeCelsius: return (baseUnitValue) / 1e3d; + case VolumetricHeatCapacityUnit.KilojoulePerCubicMeterKelvin: return (baseUnitValue) / 1e3d; + case VolumetricHeatCapacityUnit.MegajoulePerCubicMeterDegreeCelsius: return (baseUnitValue) / 1e6d; + case VolumetricHeatCapacityUnit.MegajoulePerCubicMeterKelvin: return (baseUnitValue) / 1e6d; + default: + throw new NotImplementedException($"Can not convert {Unit} to {unit}."); + } + } + + #endregion + + #region ToString Methods + + /// + /// Gets the default string representation of value and unit. + /// + /// String representation. + public override string ToString() + { + return ToString("g"); + } + + /// + /// Gets the default string representation of value and unit using the given format provider. + /// + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + public string ToString(IFormatProvider? provider) + { + return ToString("g", provider); + } + + /// + /// Get string representation of value and unit. + /// + /// The number of significant digits after the radix point. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + [Obsolete(@"This method is deprecated and will be removed at a future release. Please use ToString(""s2"") or ToString(""s2"", provider) where 2 is an example of the number passed to significantDigitsAfterRadix.")] + public string ToString(IFormatProvider? provider, int significantDigitsAfterRadix) + { + var value = Convert.ToDouble(Value); + var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix); + return ToString(provider, format); + } + + /// + /// Get string representation of value and unit. + /// + /// String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively." + /// Arguments for string format. Value and unit are implicitly included as arguments 0 and 1. + /// String representation. + /// Format to use for localization and number formatting. Defaults to if null. + [Obsolete("This method is deprecated and will be removed at a future release. Please use string.Format().")] + public string ToString(IFormatProvider? provider, [NotNull] string format, [NotNull] params object[] args) + { + if (format == null) throw new ArgumentNullException(nameof(format)); + if (args == null) throw new ArgumentNullException(nameof(args)); + + provider = provider ?? CultureInfo.CurrentUICulture; + + var value = Convert.ToDouble(Value); + var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args); + return string.Format(provider, format, formatArgs); + } + + /// + /// + /// Gets the string representation of this instance in the specified format string using . + /// + /// The format string. + /// The string representation. + public string ToString(string format) + { + return ToString(format, CultureInfo.CurrentUICulture); + } + + /// + /// + /// Gets the string representation of this instance in the specified format string using the specified format provider, or if null. + /// + /// The format string. + /// Format to use for localization and number formatting. Defaults to if null. + /// The string representation. + public string ToString(string format, IFormatProvider? provider) + { + return QuantityFormatter.Format(this, format, provider); + } + + #endregion + + #region IConvertible Methods + + TypeCode IConvertible.GetTypeCode() + { + return TypeCode.Object; + } + + bool IConvertible.ToBoolean(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(VolumetricHeatCapacity)} to bool is not supported."); + } + + byte IConvertible.ToByte(IFormatProvider provider) + { + return Convert.ToByte(_value); + } + + char IConvertible.ToChar(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(VolumetricHeatCapacity)} to char is not supported."); + } + + DateTime IConvertible.ToDateTime(IFormatProvider provider) + { + throw new InvalidCastException($"Converting {typeof(VolumetricHeatCapacity)} to DateTime is not supported."); + } + + decimal IConvertible.ToDecimal(IFormatProvider provider) + { + return Convert.ToDecimal(_value); + } + + double IConvertible.ToDouble(IFormatProvider provider) + { + return Convert.ToDouble(_value); + } + + short IConvertible.ToInt16(IFormatProvider provider) + { + return Convert.ToInt16(_value); + } + + int IConvertible.ToInt32(IFormatProvider provider) + { + return Convert.ToInt32(_value); + } + + long IConvertible.ToInt64(IFormatProvider provider) + { + return Convert.ToInt64(_value); + } + + sbyte IConvertible.ToSByte(IFormatProvider provider) + { + return Convert.ToSByte(_value); + } + + float IConvertible.ToSingle(IFormatProvider provider) + { + return Convert.ToSingle(_value); + } + + string IConvertible.ToString(IFormatProvider provider) + { + return ToString("g", provider); + } + + object IConvertible.ToType(Type conversionType, IFormatProvider provider) + { + if(conversionType == typeof(VolumetricHeatCapacity)) + return this; + else if(conversionType == typeof(VolumetricHeatCapacityUnit)) + return Unit; + else if(conversionType == typeof(QuantityType)) + return VolumetricHeatCapacity.QuantityType; + else if(conversionType == typeof(QuantityInfo)) + return VolumetricHeatCapacity.Info; + else if(conversionType == typeof(BaseDimensions)) + return VolumetricHeatCapacity.BaseDimensions; + else + throw new InvalidCastException($"Converting {typeof(VolumetricHeatCapacity)} to {conversionType} is not supported."); + } + + ushort IConvertible.ToUInt16(IFormatProvider provider) + { + return Convert.ToUInt16(_value); + } + + uint IConvertible.ToUInt32(IFormatProvider provider) + { + return Convert.ToUInt32(_value); + } + + ulong IConvertible.ToUInt64(IFormatProvider provider) + { + return Convert.ToUInt64(_value); + } + + #endregion + } +} diff --git a/UnitsNet/GeneratedCode/Quantity.g.cs b/UnitsNet/GeneratedCode/Quantity.g.cs index 302a29d152..379d90ba31 100644 --- a/UnitsNet/GeneratedCode/Quantity.g.cs +++ b/UnitsNet/GeneratedCode/Quantity.g.cs @@ -144,6 +144,7 @@ public static partial class Quantity { "VolumeConcentration", VolumeConcentration.Info }, { "VolumeFlow", VolumeFlow.Info }, { "VolumePerLength", VolumePerLength.Info }, + { "VolumetricHeatCapacity", VolumetricHeatCapacity.Info }, { "WarpingMomentOfInertia", WarpingMomentOfInertia.Info }, }; @@ -257,6 +258,7 @@ public static partial class Quantity { "VolumeConcentration", QuantityType.VolumeConcentration }, { "VolumeFlow", QuantityType.VolumeFlow }, { "VolumePerLength", QuantityType.VolumePerLength }, + { "VolumetricHeatCapacity", QuantityType.VolumetricHeatCapacity }, { "WarpingMomentOfInertia", QuantityType.WarpingMomentOfInertia }, }; @@ -483,6 +485,8 @@ public static IQuantity FromQuantityType(QuantityType quantityType, QuantityValu return VolumeFlow.From(value, VolumeFlow.BaseUnit); case QuantityType.VolumePerLength: return VolumePerLength.From(value, VolumePerLength.BaseUnit); + case QuantityType.VolumetricHeatCapacity: + return VolumetricHeatCapacity.From(value, VolumetricHeatCapacity.BaseUnit); case QuantityType.WarpingMomentOfInertia: return WarpingMomentOfInertia.From(value, WarpingMomentOfInertia.BaseUnit); default: @@ -712,6 +716,8 @@ public static IQuantity FromQuantityInfo(QuantityInfo quantityInfo, QuantityValu return VolumeFlow.From(value, VolumeFlow.BaseUnit); case "VolumePerLength": return VolumePerLength.From(value, VolumePerLength.BaseUnit); + case "VolumetricHeatCapacity": + return VolumetricHeatCapacity.From(value, VolumetricHeatCapacity.BaseUnit); case "WarpingMomentOfInertia": return WarpingMomentOfInertia.From(value, WarpingMomentOfInertia.BaseUnit); default: @@ -1048,6 +1054,9 @@ public static bool TryFrom(QuantityValue value, Enum unit, out IQuantity? quanti case VolumePerLengthUnit volumePerLengthUnit: quantity = VolumePerLength.From(value, volumePerLengthUnit); return true; + case VolumetricHeatCapacityUnit volumetricHeatCapacityUnit: + quantity = VolumetricHeatCapacity.From(value, volumetricHeatCapacityUnit); + return true; case WarpingMomentOfInertiaUnit warpingMomentOfInertiaUnit: quantity = WarpingMomentOfInertia.From(value, warpingMomentOfInertiaUnit); return true; @@ -1290,6 +1299,8 @@ public static bool TryParse(IFormatProvider? formatProvider, Type quantityType, return parser.TryParse(quantityString, formatProvider, VolumeFlow.From, out quantity); case Type _ when quantityType == typeof(VolumePerLength): return parser.TryParse(quantityString, formatProvider, VolumePerLength.From, out quantity); + case Type _ when quantityType == typeof(VolumetricHeatCapacity): + return parser.TryParse(quantityString, formatProvider, VolumetricHeatCapacity.From, out quantity); case Type _ when quantityType == typeof(WarpingMomentOfInertia): return parser.TryParse(quantityString, formatProvider, WarpingMomentOfInertia.From, out quantity); default: diff --git a/UnitsNet/GeneratedCode/QuantityType.g.cs b/UnitsNet/GeneratedCode/QuantityType.g.cs index dded4d524f..487624b259 100644 --- a/UnitsNet/GeneratedCode/QuantityType.g.cs +++ b/UnitsNet/GeneratedCode/QuantityType.g.cs @@ -137,6 +137,7 @@ public enum QuantityType VolumeConcentration, VolumeFlow, VolumePerLength, + VolumetricHeatCapacity, WarpingMomentOfInertia, // Missing XML comment for public type or member #pragma warning restore CS1591 diff --git a/UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs b/UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs index 91787c2b1d..ca8e554c6e 100644 --- a/UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs +++ b/UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs @@ -1678,6 +1678,15 @@ private static readonly (string CultureName, Type UnitType, int UnitValue, strin ("en-US", typeof(VolumePerLengthUnit), (int)VolumePerLengthUnit.LiterPerMeter, new string[]{"l/m"}), ("en-US", typeof(VolumePerLengthUnit), (int)VolumePerLengthUnit.LiterPerMillimeter, new string[]{"l/mm"}), ("en-US", typeof(VolumePerLengthUnit), (int)VolumePerLengthUnit.OilBarrelPerFoot, new string[]{"bbl/ft"}), + ("en-US", typeof(VolumetricHeatCapacityUnit), (int)VolumetricHeatCapacityUnit.BtuPerCubicFootDegreeFahrenheit, new string[]{"BTU/ft³·°F"}), + ("en-US", typeof(VolumetricHeatCapacityUnit), (int)VolumetricHeatCapacityUnit.CaloriePerCubicCentimeterDegreeCelsius, new string[]{"cal/cm³·°C"}), + ("en-US", typeof(VolumetricHeatCapacityUnit), (int)VolumetricHeatCapacityUnit.JoulePerCubicMeterDegreeCelsius, new string[]{"J/m³·°C"}), + ("en-US", typeof(VolumetricHeatCapacityUnit), (int)VolumetricHeatCapacityUnit.JoulePerCubicMeterKelvin, new string[]{"J/m³·K"}), + ("en-US", typeof(VolumetricHeatCapacityUnit), (int)VolumetricHeatCapacityUnit.KilocaloriePerCubicCentimeterDegreeCelsius, new string[]{"kcal/cm³·°C"}), + ("en-US", typeof(VolumetricHeatCapacityUnit), (int)VolumetricHeatCapacityUnit.KilojoulePerCubicMeterDegreeCelsius, new string[]{"kJ/m³·°C"}), + ("en-US", typeof(VolumetricHeatCapacityUnit), (int)VolumetricHeatCapacityUnit.KilojoulePerCubicMeterKelvin, new string[]{"kJ/m³·K"}), + ("en-US", typeof(VolumetricHeatCapacityUnit), (int)VolumetricHeatCapacityUnit.MegajoulePerCubicMeterDegreeCelsius, new string[]{"MJ/m³·°C"}), + ("en-US", typeof(VolumetricHeatCapacityUnit), (int)VolumetricHeatCapacityUnit.MegajoulePerCubicMeterKelvin, new string[]{"MJ/m³·K"}), ("en-US", typeof(WarpingMomentOfInertiaUnit), (int)WarpingMomentOfInertiaUnit.CentimeterToTheSixth, new string[]{"cm⁶", "cm^6"}), ("en-US", typeof(WarpingMomentOfInertiaUnit), (int)WarpingMomentOfInertiaUnit.DecimeterToTheSixth, new string[]{"dm⁶", "dm^6"}), ("en-US", typeof(WarpingMomentOfInertiaUnit), (int)WarpingMomentOfInertiaUnit.FootToTheSixth, new string[]{"ft⁶", "ft^6"}), diff --git a/UnitsNet/GeneratedCode/UnitConverter.g.cs b/UnitsNet/GeneratedCode/UnitConverter.g.cs index 79f9723a79..50992a2ee7 100644 --- a/UnitsNet/GeneratedCode/UnitConverter.g.cs +++ b/UnitsNet/GeneratedCode/UnitConverter.g.cs @@ -2500,6 +2500,23 @@ public static void RegisterDefaultConversions(UnitConverter unitConverter) unitConverter.SetConversionFunction(VolumePerLengthUnit.LiterPerMillimeter, VolumePerLength.BaseUnit, q => q.ToBaseUnit()); unitConverter.SetConversionFunction(VolumePerLength.BaseUnit, VolumePerLengthUnit.OilBarrelPerFoot, q => q.ToUnit(VolumePerLengthUnit.OilBarrelPerFoot)); unitConverter.SetConversionFunction(VolumePerLengthUnit.OilBarrelPerFoot, VolumePerLength.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction(VolumetricHeatCapacity.BaseUnit, VolumetricHeatCapacityUnit.BtuPerCubicFootDegreeFahrenheit, q => q.ToUnit(VolumetricHeatCapacityUnit.BtuPerCubicFootDegreeFahrenheit)); + unitConverter.SetConversionFunction(VolumetricHeatCapacityUnit.BtuPerCubicFootDegreeFahrenheit, VolumetricHeatCapacity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction(VolumetricHeatCapacity.BaseUnit, VolumetricHeatCapacityUnit.CaloriePerCubicCentimeterDegreeCelsius, q => q.ToUnit(VolumetricHeatCapacityUnit.CaloriePerCubicCentimeterDegreeCelsius)); + unitConverter.SetConversionFunction(VolumetricHeatCapacityUnit.CaloriePerCubicCentimeterDegreeCelsius, VolumetricHeatCapacity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction(VolumetricHeatCapacity.BaseUnit, VolumetricHeatCapacityUnit.JoulePerCubicMeterDegreeCelsius, q => q.ToUnit(VolumetricHeatCapacityUnit.JoulePerCubicMeterDegreeCelsius)); + unitConverter.SetConversionFunction(VolumetricHeatCapacityUnit.JoulePerCubicMeterDegreeCelsius, VolumetricHeatCapacity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction(VolumetricHeatCapacity.BaseUnit, VolumetricHeatCapacity.BaseUnit, q => q); + unitConverter.SetConversionFunction(VolumetricHeatCapacity.BaseUnit, VolumetricHeatCapacityUnit.KilocaloriePerCubicCentimeterDegreeCelsius, q => q.ToUnit(VolumetricHeatCapacityUnit.KilocaloriePerCubicCentimeterDegreeCelsius)); + unitConverter.SetConversionFunction(VolumetricHeatCapacityUnit.KilocaloriePerCubicCentimeterDegreeCelsius, VolumetricHeatCapacity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction(VolumetricHeatCapacity.BaseUnit, VolumetricHeatCapacityUnit.KilojoulePerCubicMeterDegreeCelsius, q => q.ToUnit(VolumetricHeatCapacityUnit.KilojoulePerCubicMeterDegreeCelsius)); + unitConverter.SetConversionFunction(VolumetricHeatCapacityUnit.KilojoulePerCubicMeterDegreeCelsius, VolumetricHeatCapacity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction(VolumetricHeatCapacity.BaseUnit, VolumetricHeatCapacityUnit.KilojoulePerCubicMeterKelvin, q => q.ToUnit(VolumetricHeatCapacityUnit.KilojoulePerCubicMeterKelvin)); + unitConverter.SetConversionFunction(VolumetricHeatCapacityUnit.KilojoulePerCubicMeterKelvin, VolumetricHeatCapacity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction(VolumetricHeatCapacity.BaseUnit, VolumetricHeatCapacityUnit.MegajoulePerCubicMeterDegreeCelsius, q => q.ToUnit(VolumetricHeatCapacityUnit.MegajoulePerCubicMeterDegreeCelsius)); + unitConverter.SetConversionFunction(VolumetricHeatCapacityUnit.MegajoulePerCubicMeterDegreeCelsius, VolumetricHeatCapacity.BaseUnit, q => q.ToBaseUnit()); + unitConverter.SetConversionFunction(VolumetricHeatCapacity.BaseUnit, VolumetricHeatCapacityUnit.MegajoulePerCubicMeterKelvin, q => q.ToUnit(VolumetricHeatCapacityUnit.MegajoulePerCubicMeterKelvin)); + unitConverter.SetConversionFunction(VolumetricHeatCapacityUnit.MegajoulePerCubicMeterKelvin, VolumetricHeatCapacity.BaseUnit, q => q.ToBaseUnit()); unitConverter.SetConversionFunction(WarpingMomentOfInertia.BaseUnit, WarpingMomentOfInertiaUnit.CentimeterToTheSixth, q => q.ToUnit(WarpingMomentOfInertiaUnit.CentimeterToTheSixth)); unitConverter.SetConversionFunction(WarpingMomentOfInertiaUnit.CentimeterToTheSixth, WarpingMomentOfInertia.BaseUnit, q => q.ToBaseUnit()); unitConverter.SetConversionFunction(WarpingMomentOfInertia.BaseUnit, WarpingMomentOfInertiaUnit.DecimeterToTheSixth, q => q.ToUnit(WarpingMomentOfInertiaUnit.DecimeterToTheSixth)); diff --git a/UnitsNet/GeneratedCode/Units/VolumetricHeatCapacityUnit.g.cs b/UnitsNet/GeneratedCode/Units/VolumetricHeatCapacityUnit.g.cs new file mode 100644 index 0000000000..2f18602337 --- /dev/null +++ b/UnitsNet/GeneratedCode/Units/VolumetricHeatCapacityUnit.g.cs @@ -0,0 +1,41 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by \generate-code.bat. +// +// Changes to this file will be lost when the code is regenerated. +// The build server regenerates the code before each build and a pre-build +// step will regenerate the code on each local build. +// +// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units. +// +// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities. +// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities. +// +// +//------------------------------------------------------------------------------ + +// 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. + +// ReSharper disable once CheckNamespace +namespace UnitsNet.Units +{ + // Disable missing XML comment warnings for the generated unit enums. + #pragma warning disable 1591 + + public enum VolumetricHeatCapacityUnit + { + Undefined = 0, + BtuPerCubicFootDegreeFahrenheit, + CaloriePerCubicCentimeterDegreeCelsius, + JoulePerCubicMeterDegreeCelsius, + JoulePerCubicMeterKelvin, + KilocaloriePerCubicCentimeterDegreeCelsius, + KilojoulePerCubicMeterDegreeCelsius, + KilojoulePerCubicMeterKelvin, + MegajoulePerCubicMeterDegreeCelsius, + MegajoulePerCubicMeterKelvin, + } + + #pragma warning restore 1591 +}