Skip to content

Commit af077f2

Browse files
Merge pull request #398 from Lempireqc/master
Just add simple test
2 parents 44c4dfe + 61c06f4 commit af077f2

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/System.Linq.Dynamic.Core.Tests/MikArea/Dictionary.cs

+21
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Linq;
4+
using System.Linq.Expressions;
45
using System.Text;
56
using System.Threading.Tasks;
67
using NFluent;
@@ -89,5 +90,25 @@ public void Test_ContainsKey_3()
8990
Check.That("ZZZ1").IsEqualTo((string)data.First().City);
9091
Check.That(3).IsEqualTo(data.Count);
9192
}
93+
94+
[Fact]
95+
public void Test_DynamicIndexCall()
96+
{
97+
{
98+
object CreateDicParameter(string name) => new Dictionary<string, object>
99+
{
100+
{"Name", new Dictionary<string, object> {{"FirstName", name }, {"LastName", name + "Test" }}},
101+
};
102+
103+
var parType = new Dictionary<string, object>().GetType();
104+
var lambda = DynamicExpressionParser.ParseLambda(new[] { Expression.Parameter(parType, "item") }, typeof(object), "item.Name.FirstName + \"7\" + item.Name.LastName ").Compile();
105+
106+
var x1 = lambda.DynamicInvoke(CreateDicParameter("Julio"));
107+
var x2 = lambda.DynamicInvoke(CreateDicParameter("John"));
108+
109+
Check.That(x1).IsEqualTo("Julio7JulioTest");
110+
Check.That(x2).IsEqualTo("John7JohnTest");
111+
}
112+
}
92113
}
93114
}

0 commit comments

Comments
 (0)