Skip to content

Commit e5a2530

Browse files
committed
Support for parsing conditional and operator.
1 parent e6ecea9 commit e5a2530

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

TestStack.FluentMVCTesting.Tests/Internal/ExpressionInspectorTests.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,17 @@ public void Correctly_parse_conditional_or_operator()
8383
Assert.AreEqual("text => ((text == \"any\") || (text.Length == 3))", actual);
8484
}
8585

86+
87+
[Test]
88+
public void Correctly_parse_conditional_and_operator()
89+
{
90+
Expression<Func<string, bool>> func =
91+
text => text == "any" && text.Length == 3;
92+
ExpressionInspector sut = new ExpressionInspector();
93+
var actual = sut.Inspect(func);
94+
Assert.AreEqual("text => ((text == \"any\") && (text.Length == 3))", actual);
95+
}
96+
8697
[Test]
8798
public void Correctly_parse_two_conditional_or_operators()
8899
{

TestStack.FluentMvcTesting/Internal/ExpressionInspector.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ internal class ExpressionInspector
88
internal string Inspect(LambdaExpression expression)
99
{
1010
return expression.ToString()
11-
.Replace(" OrElse ", " || ");
11+
.Replace(" OrElse ", " || ")
12+
.Replace(" AndAlso ", " && ");
1213
}
1314
}
1415
}

0 commit comments

Comments
 (0)