forked from zzzprojects/System.Linq.Dynamic.Core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExpressionParserTests.MemberAccess.cs
More file actions
34 lines (29 loc) · 1.06 KB
/
ExpressionParserTests.MemberAccess.cs
File metadata and controls
34 lines (29 loc) · 1.06 KB
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
33
34
using System.Linq.Dynamic.Core.Parser;
using System.Linq.Expressions;
using FluentAssertions;
using Xunit;
namespace System.Linq.Dynamic.Core.Tests.Parser
{
partial class ExpressionParserTests
{
[Fact]
public void ParseMemberAccess_DictionaryIndex_On_Dynamic()
{
// Arrange
var products = (new ProductDynamic[0]).AsQueryable();
// Act
var expression = products.Where("Properties.Name == @0", "First Product").Expression;
// Assert
#if NET452 || NET461
expression.ToString().Should().Be("System.Linq.Dynamic.Core.Tests.Parser.ProductDynamic[].Where(Param_0 => (GetMember Name(Param_0.Properties) == Convert(\"First Product\")))");
#else
expression.ToString().Should().Be("System.Linq.Dynamic.Core.Tests.Parser.ProductDynamic[].Where(Param_0 => ([Dynamic] == Convert(\"First Product\", Object)))");
#endif
}
}
public class ProductDynamic
{
public string ProductId { get; set; }
public dynamic Properties { get; set; }
}
}