Details
-
Bug
-
Resolution: Fixed
-
Unknown
-
None
-
None
-
None
-
Fully Compatible
-
Not Needed
-
Description
Usage of Math.Round throws ExpressionNotSupportedException exception. Here is the minimal code to reproduce the issue:
public class MathRoundTests : Linq3IntegrationTest |
{
|
[Fact]
|
public void Math_round() |
{
|
var collection = CreateCollection();
|
|
|
var query = collection.AsQueryable()
|
.Where(i => Math.Round(i.A) == 10); |
|
|
var results = query.ToList();
|
|
|
results.Should().OnlyContain(i => Math.Round(i.A) == 10); |
}
|
|
|
private IMongoCollection<Data> CreateCollection() |
{
|
var collection = GetCollection<Data>("test"); |
CreateCollection(
|
collection,
|
new Data { A = 10.234 }, |
new Data { A = 9.6 }, |
new Data { A = 9.2 }, |
new Data { A = 5.42 }); |
return collection; |
}
|
|
|
private class Data |
{
|
public double A { get; set; } |
}
|
}
|