File tree Expand file tree Collapse file tree 3 files changed +38
-2
lines changed
UnitsNet.Tests/CustomCode
UnitsNet/CustomCode/Quantities Expand file tree Collapse file tree 3 files changed +38
-2
lines changed Original file line number Diff line number Diff line change 21
21
// Licensed under MIT No Attribution, see LICENSE file at the root.
22
22
// Copyright 2013 Andreas Gullberg Larsen ([email protected] ). Maintained at https://github.com/angularsen/UnitsNet.
23
23
24
-
25
- using System ;
24
+ using Xunit ;
26
25
27
26
namespace UnitsNet . Tests . CustomCode
28
27
{
@@ -35,5 +34,25 @@ public class CoefficientOfThermalExpansionTests : CoefficientOfThermalExpansionT
35
34
protected override double InverseDegreeFahrenheitInOneInverseKelvin => 0.5555555555555556 ;
36
35
37
36
protected override double InverseKelvinInOneInverseKelvin => 1.0 ;
37
+
38
+ [ Fact ]
39
+ public void CoefficientOfThermalExpansionTimesTemperatureDelta ( )
40
+ {
41
+ double temperatureDeltaDegC = 2.0 ;
42
+ double ctePerDegC = 0.001 ;
43
+ CoefficientOfThermalExpansion cte = CoefficientOfThermalExpansion . FromInverseDegreeCelsius ( ctePerDegC ) ;
44
+ TemperatureDelta dT = TemperatureDelta . FromDegreesCelsius ( temperatureDeltaDegC ) ;
45
+ AssertEx . EqualTolerance ( cte * dT , ctePerDegC * temperatureDeltaDegC , 1e-10 ) ;
46
+ }
47
+
48
+ [ Fact ]
49
+ public void TemperatureDeltaTimesCoefficientOfThermalExpansion ( )
50
+ {
51
+ double temperatureDeltaDegC = 2.0 ;
52
+ double ctePerDegC = 0.001 ;
53
+ CoefficientOfThermalExpansion cte = CoefficientOfThermalExpansion . FromInverseDegreeCelsius ( ctePerDegC ) ;
54
+ TemperatureDelta dT = TemperatureDelta . FromDegreesCelsius ( temperatureDeltaDegC ) ;
55
+ AssertEx . EqualTolerance ( dT * cte , temperatureDeltaDegC * ctePerDegC , 1e-10 ) ;
56
+ }
38
57
}
39
58
}
Original file line number Diff line number Diff line change
1
+ // Licensed under MIT No Attribution, see LICENSE file at the root.
2
+ // Copyright 2013 Andreas Gullberg Larsen ([email protected] ). Maintained at https://github.com/angularsen/UnitsNet.
3
+
4
+ namespace UnitsNet
5
+ {
6
+ public partial struct CoefficientOfThermalExpansion
7
+ {
8
+ /// <summary>Get a scalar from a <see cref="CoefficientOfThermalExpansion"/> multiplied by a <see cref="TemperatureDelta"/>.</summary>
9
+ public static double operator * ( CoefficientOfThermalExpansion cte , TemperatureDelta temperatureDelta ) => cte . InverseKelvin * temperatureDelta . Kelvins ;
10
+ }
11
+ }
Original file line number Diff line number Diff line change @@ -34,5 +34,11 @@ public partial struct TemperatureDelta
34
34
{
35
35
return Energy . FromJoules ( entropy . JoulesPerKelvin * temperatureDelta . Kelvins ) ;
36
36
}
37
+
38
+ /// <summary>Get a scalar from a <see cref="TemperatureDelta"/> multiplied by a <see cref="CoefficientOfThermalExpansion"/>.</summary>
39
+ public static double operator * ( TemperatureDelta temperatureDelta , CoefficientOfThermalExpansion cte )
40
+ {
41
+ return temperatureDelta . Kelvins * cte . InverseKelvin ;
42
+ }
37
43
}
38
44
}
You can’t perform that action at this time.
0 commit comments