forked from zzzprojects/System.Linq.Dynamic.Core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOperatorTests.cs
More file actions
32 lines (27 loc) · 944 Bytes
/
OperatorTests.cs
File metadata and controls
32 lines (27 loc) · 944 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System.Linq.Dynamic.Core.Exceptions;
using System.Linq.Dynamic.Core.Tests.Helpers.Models;
using Xunit;
namespace System.Linq.Dynamic.Core.Tests
{
public class OperatorTests
{
[Fact]
public void Operator_Multiplication_Single_Float_ParseException()
{
//Arrange
var models = new[] { new SimpleValuesModel() }.AsQueryable();
//Act + Assert
Assert.Throws<ParseException>(() => models.Select("FloatValue * DecimalValue"));
}
[Fact]
public void Operator_Multiplication_Single_Float_Cast()
{
//Arrange
var models = new SimpleValuesModel[] { new SimpleValuesModel() { FloatValue = 2, DecimalValue = 3 } }.AsQueryable();
//Act
var result = models.Select("Decimal(FloatValue) * DecimalValue").First();
//Assert
Assert.Equal(6.0m, result);
}
}
}