Skip to content

Commit 47566fa

Browse files
committed
Support for parsing equality operator with property operands.
1 parent 47486bf commit 47566fa

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

TestStack.FluentMVCTesting.Tests/Internal/ExpressionInspectorTests.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,24 @@ public void Correctly_parse_equality_comparison_with_int_operands()
2626
Assert.AreEqual("number => number == 5", actual);
2727
}
2828

29+
[Test]
30+
public void Correctly_parse_equality_comparison_with_property_operand()
31+
{
32+
Expression<Func<PostViewModel, bool>> func = post => post.Title == "A";
33+
ExpressionInspector sut = new ExpressionInspector();
34+
var actual = sut.Inspect(func);
35+
Assert.AreEqual("post => post.Title == \"A\"", actual);
36+
}
37+
38+
[Test]
39+
public void Correctly_parse_equality_comparison_with_property_operands()
40+
{
41+
Expression<Func<PostViewModel, bool>> func = post => post.Title == post.Slug;
42+
ExpressionInspector sut = new ExpressionInspector();
43+
var actual = sut.Inspect(func);
44+
Assert.AreEqual("post => post.Title == post.Slug", actual);
45+
}
46+
2947
[Test]
3048
public void Correctly_parse_inequality_comparison()
3149
{
@@ -54,4 +72,10 @@ public void Correctly_parse_relational_comparison()
5472
Assert.AreEqual("number => number < 5", actual);
5573
}
5674
}
75+
76+
public class PostViewModel
77+
{
78+
public string Title { get; set; }
79+
public string Slug { get; set; }
80+
}
5781
}

0 commit comments

Comments
 (0)