@@ -71,11 +71,42 @@ public void Correctly_parse_relational_comparison()
7171 var actual = sut . Inspect ( func ) ;
7272 Assert . AreEqual ( "number => number < 5" , actual ) ;
7373 }
74+
75+ [ Test ]
76+ public void Correctly_parse_conditional_or_operator ( )
77+ {
78+ Expression < Func < string , bool > > func =
79+ text => text == "any" || text . Length == 3 ;
80+ ExpressionInspector sut = new ExpressionInspector ( ) ;
81+ var actual = sut . Inspect ( func ) ;
82+ Assert . AreEqual ( "text => text == \" any\" || text.Length == 3" , actual ) ;
83+ }
84+
85+ public void Correctly_parse_two_conditional_or_operators ( )
86+ {
87+ Expression < Func < string , bool > > func =
88+ text => text == "any" || text . Length == 3 || text . Length == 9 ;
89+ ExpressionInspector sut = new ExpressionInspector ( ) ;
90+ var actual = sut . Inspect ( func ) ;
91+ Assert . AreEqual ( "text => text == \" any\" || text.Length == 3 || text.Length == 9" , actual ) ;
92+ }
93+
94+ [ Test ]
95+ public void Not_mistake_property_called_OrElse_for_conditional_or_operator ( )
96+ {
97+ Expression < Func < PostViewModel , bool > > func =
98+ post => post . Title == "" || post . OrElse == "" ;
99+ ExpressionInspector sut = new ExpressionInspector ( ) ;
100+ var actual = sut . Inspect ( func ) ;
101+ Assert . AreEqual ( "post => post.Title == \" \" || post.OrElse == \" \" " , actual ) ;
102+ }
74103 }
75104
76105 public class PostViewModel
77106 {
78107 public string Title { get ; set ; }
79108 public string Slug { get ; set ; }
109+
110+ public string OrElse { get ; set ; }
80111 }
81112}
0 commit comments