forked from zzzprojects/System.Linq.Dynamic.Core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathParseLambda.cs
More file actions
26 lines (23 loc) · 826 Bytes
/
ParseLambda.cs
File metadata and controls
26 lines (23 loc) · 826 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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using Xunit;
using NFluent;
namespace System.Linq.Dynamic.Core.Tests.MikArea
{
public class ParseLambda
{
[Fact]
public void Test_ParseLambda_1()
{
var expression = (Action<int>)DynamicExpressionParser.ParseLambda(typeof(Action<int>), new[] { Expression.Parameter(typeof(int), "x") }, typeof(int), "x + 1").Compile();
var expression2 = (Func<int, int>)DynamicExpressionParser.ParseLambda(typeof(Func<int, int>), new[] { Expression.Parameter(typeof(int), "x") }, typeof(int), "x + 1").Compile();
expression(3);
var t = expression2(4);
Check.That(t).IsEqualTo(5);
}
}
}