@@ -14,7 +14,7 @@ public void Correctly_parse_equality_comparison_with_string_operands()
14
14
Expression < Func < string , bool > > func = text => text == "any" ;
15
15
ExpressionInspector sut = new ExpressionInspector ( ) ;
16
16
var actual = sut . Inspect ( func ) ;
17
- Assert . AreEqual ( "text => text == \" any\" " , actual ) ;
17
+ Assert . AreEqual ( "text => ( text == \" any\" ) " , actual ) ;
18
18
}
19
19
20
20
[ Test ]
@@ -23,7 +23,7 @@ public void Correctly_parse_equality_comparison_with_int_operands()
23
23
Expression < Func < int , bool > > func = number => number == 5 ;
24
24
ExpressionInspector sut = new ExpressionInspector ( ) ;
25
25
var actual = sut . Inspect ( func ) ;
26
- Assert . AreEqual ( "number => number == 5" , actual ) ;
26
+ Assert . AreEqual ( "number => ( number == 5) " , actual ) ;
27
27
}
28
28
29
29
[ Test ]
@@ -32,7 +32,7 @@ public void Correctly_parse_equality_comparison_with_property_operand()
32
32
Expression < Func < PostViewModel , bool > > func = post => post . Title == "A" ;
33
33
ExpressionInspector sut = new ExpressionInspector ( ) ;
34
34
var actual = sut . Inspect ( func ) ;
35
- Assert . AreEqual ( "post => post.Title == \" A\" " , actual ) ;
35
+ Assert . AreEqual ( "post => ( post.Title == \" A\" ) " , actual ) ;
36
36
}
37
37
38
38
[ Test ]
@@ -41,7 +41,7 @@ public void Correctly_parse_equality_comparison_with_property_operands()
41
41
Expression < Func < PostViewModel , bool > > func = post => post . Title == post . Slug ;
42
42
ExpressionInspector sut = new ExpressionInspector ( ) ;
43
43
var actual = sut . Inspect ( func ) ;
44
- Assert . AreEqual ( "post => post.Title == post.Slug" , actual ) ;
44
+ Assert . AreEqual ( "post => ( post.Title == post.Slug) " , actual ) ;
45
45
}
46
46
47
47
[ Test ]
@@ -50,7 +50,7 @@ public void Correctly_parse_inequality_comparison()
50
50
Expression < Func < int , bool > > func = number => number != 5 ;
51
51
ExpressionInspector sut = new ExpressionInspector ( ) ;
52
52
var actual = sut . Inspect ( func ) ;
53
- Assert . AreEqual ( "number => number != 5" , actual ) ;
53
+ Assert . AreEqual ( "number => ( number != 5) " , actual ) ;
54
54
}
55
55
56
56
[ Test ]
@@ -60,7 +60,8 @@ public void Correctly_parse_equality_comparison_with_captured_constant_operand()
60
60
Expression < Func < int , bool > > func = number => number == Number ;
61
61
ExpressionInspector sut = new ExpressionInspector ( ) ;
62
62
var actual = sut . Inspect ( func ) ;
63
- Assert . AreEqual ( "number => number == " + Number , actual ) ;
63
+ Assert . AreEqual (
64
+ string . Concat ( "number => (number == " , Number , ")" ) , actual ) ;
64
65
}
65
66
66
67
[ Test ]
@@ -69,7 +70,7 @@ public void Correctly_parse_relational_comparison()
69
70
Expression < Func < int , bool > > func = number => number < 5 ;
70
71
ExpressionInspector sut = new ExpressionInspector ( ) ;
71
72
var actual = sut . Inspect ( func ) ;
72
- Assert . AreEqual ( "number => number < 5" , actual ) ;
73
+ Assert . AreEqual ( "number => ( number < 5) " , actual ) ;
73
74
}
74
75
75
76
[ Test ]
@@ -79,7 +80,7 @@ public void Correctly_parse_conditional_or_operator()
79
80
text => text == "any" || text . Length == 3 ;
80
81
ExpressionInspector sut = new ExpressionInspector ( ) ;
81
82
var actual = sut . Inspect ( func ) ;
82
- Assert . AreEqual ( "text => text == \" any\" || text.Length == 3" , actual ) ;
83
+ Assert . AreEqual ( "text => (( text == \" any\" ) || ( text.Length == 3)) " , actual ) ;
83
84
}
84
85
85
86
[ Test ]
@@ -89,7 +90,7 @@ public void Correctly_parse_two_conditional_or_operators()
89
90
text => text == "any" || text . Length == 3 || text . Length == 9 ;
90
91
ExpressionInspector sut = new ExpressionInspector ( ) ;
91
92
var actual = sut . Inspect ( func ) ;
92
- Assert . AreEqual ( "text => text == \" any\" || text.Length == 3 || text.Length == 9" , actual ) ;
93
+ Assert . AreEqual ( "text => ((( text == \" any\" ) || ( text.Length == 3)) || ( text.Length == 9)) " , actual ) ;
93
94
}
94
95
95
96
[ Test ]
@@ -99,7 +100,7 @@ public void Not_mistake_property_called_OrElse_for_conditional_or_operator()
99
100
post => post . Title == "" || post . OrElse == "" ;
100
101
ExpressionInspector sut = new ExpressionInspector ( ) ;
101
102
var actual = sut . Inspect ( func ) ;
102
- Assert . AreEqual ( "post => post.Title == \" \" || post.OrElse == \" \" " , actual ) ;
103
+ Assert . AreEqual ( "post => (( post.Title == \" \" ) || ( post.OrElse == \" \" )) " , actual ) ;
103
104
}
104
105
105
106
[ Test ]
0 commit comments