Skip to content

Commit afc73c4

Browse files
lwestfallangularsen
authored andcommitted
AreaMomentOfInertia operator / overload (#710)
* Added operator / overload for AreaMomentOfInertia to get Volume when dividing by length * Added test case for AreaMomentOfInertia operator / overload
1 parent ef3d5c3 commit afc73c4

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

UnitsNet.Tests/CustomCode/AreaMomentOfInertiaTests.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323

2424
using System;
25+
using Xunit;
2526

2627
namespace UnitsNet.Tests.CustomCode
2728
{
@@ -38,5 +39,12 @@ public class AreaMomentOfInertiaTests : AreaMomentOfInertiaTestsBase
3839
protected override double MetersToTheFourthInOneMeterToTheFourth => 1;
3940

4041
protected override double MillimetersToTheFourthInOneMeterToTheFourth => 1e12;
42+
43+
[Fact]
44+
public void AreaMomentOfInertiaDividedByLengthEqualsVolume()
45+
{
46+
Volume volume = AreaMomentOfInertia.FromMetersToTheFourth(20) / Length.FromMeters(10);
47+
Assert.Equal(Volume.FromCubicMeters(2), volume);
48+
}
4149
}
4250
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
using System;
5+
6+
namespace UnitsNet
7+
{
8+
public partial struct AreaMomentOfInertia
9+
{
10+
/// <summary>Get <see cref="Volume"/> from <see cref="AreaMomentOfInertia"/> divided by <see cref="Length"/>.</summary>
11+
public static Volume operator /(AreaMomentOfInertia areaMomentOfInertia, Length length)
12+
{
13+
return Volume.FromCubicMeters(areaMomentOfInertia.MetersToTheFourth / length.Meters);
14+
}
15+
}
16+
}

0 commit comments

Comments
 (0)