Skip to content

Commit

Permalink
DynamicExpressionParser_ParseLambda_StringEquals_WithMemberString
Browse files Browse the repository at this point in the history
  • Loading branch information
StefH committed Apr 26, 2024
1 parent a76d856 commit 91d3c5f
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1676,6 +1676,30 @@ public void DynamicExpressionParser_ParseLambda_StringEquals_WithConstantString(
result.Should().Be(true);
}

[Fact]
public void DynamicExpressionParser_ParseLambda_StringEquals_WithMemberString()
{
// Arrange
var parameters = new[]
{
Expression.Parameter(typeof(MyClass), "myClass")
};

var invokerArguments = new List<object>
{
new MyClass { Name = "Foo" }
};

// Act
var expression = "Name == \"test\" || Name.Equals(\"foo\", StringComparison.OrdinalIgnoreCase)";
var lambdaExpression = DynamicExpressionParser.ParseLambda(parameters, null, expression);
var del = lambdaExpression.Compile();
var result = del.DynamicInvoke(invokerArguments.ToArray());

// Assert
result.Should().Be(true);
}

[Fact]
public void DynamicExpressionParser_ParseLambda_NullPropagation_InstanceMethod_0_Arguments()
{
Expand Down

0 comments on commit 91d3c5f

Please sign in to comment.