Skip to content

Commit 63a5b2a

Browse files
committed
Implement Decimal.Truncate
1 parent 8906825 commit 63a5b2a

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/NHibernate.Test/NHSpecificTest/GH0831/FixtureByCode.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,18 @@ public void CanHandleFloor()
135135
CanSelect(e => decimal.Floor(e.EntityValue));
136136
});
137137
}
138+
139+
[Test]
140+
public void CanHandleTruncate()
141+
{
142+
AssumeFunctionSupported("truncate");
143+
144+
Assert.Multiple(() =>
145+
{
146+
CanFilter(e => decimal.Truncate(e.EntityValue) > 1.0m);
147+
CanSelect(e => decimal.Truncate(e.EntityValue));
148+
});
149+
}
138150

139151
[Test]
140152
public void CanHandleMultiply()

src/NHibernate/Linq/Functions/MathGenerator.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public MathGenerator()
5555

5656
ReflectHelper.GetMethodDefinition(() => Math.Truncate(default(decimal))),
5757
ReflectHelper.GetMethodDefinition(() => Math.Truncate(default(double))),
58+
ReflectHelper.GetMethodDefinition(() => decimal.Truncate(default(decimal))),
5859

5960
ReflectHelper.GetMethodDefinition(() => Math.Pow(default(double), default(double))),
6061
};

0 commit comments

Comments
 (0)