@@ -1111,6 +1111,13 @@ public static IEnumerable<TestCaseData> TestCasesForWithCustomVariablesExpressio
11111111 yield return new TestCaseData ( "nullVar?[1][3]" , onInstanceVariables , true ) . SetCategory ( "Instance Property,Null Conditional indexing" ) . Returns ( null ) ;
11121112 yield return new TestCaseData ( "simpleArray2?[3]?.Trim()" , onInstanceVariables , true ) . SetCategory ( "Instance Property,Null Conditional indexing" ) . Returns ( null ) ;
11131113
1114+ yield return new TestCaseData ( "false && 1/0 == 0" , onInstanceVariables , true ) . SetCategory ( "Instance Property,And Conditional" ) . Returns ( false ) ;
1115+ yield return new TestCaseData ( "!string.IsNullOrEmpty(nullVar) && nullVar.StartsWith(\" ABC\" )" , onInstanceVariables , true ) . SetCategory ( "Instance Property,And Conditional" ) . Returns ( false ) ;
1116+ yield return new TestCaseData ( "string.IsNullOrEmpty(nullVar) || nullVar.StartsWith(\" ABC\" )" , onInstanceVariables , true ) . SetCategory ( "Instance Property,Or Conditional" ) . Returns ( true ) ;
1117+ yield return new TestCaseData ( "true || 1/0 == 0" , onInstanceVariables , true ) . SetCategory ( "Instance Property,Or Conditional" ) . Returns ( true ) ;
1118+ yield return new TestCaseData ( "false && true || true" , onInstanceVariables , true ) . SetCategory ( "Instance Property,Or Conditional,And Conditional,Precedence check" ) . Returns ( true ) ;
1119+ yield return new TestCaseData ( "true || true && false" , onInstanceVariables , true ) . SetCategory ( "Instance Property,Or Conditional,And Conditional,Precedence check" ) . Returns ( true ) ;
1120+
11141121 yield return new TestCaseData ( "simpleInt.ToString()" , onInstanceVariables , true ) . SetCategory ( "Instance Method" ) . Returns ( "42" ) ;
11151122 yield return new TestCaseData ( "simpleInt.ToString().Length" , onInstanceVariables , true ) . SetCategory ( "Instance Method,Instance Property" ) . Returns ( 2 ) ;
11161123
@@ -1141,6 +1148,11 @@ public static IEnumerable<TestCaseData> TestCasesForWithCustomVariablesExpressio
11411148 yield return new TestCaseData ( "simpleInt++ - simpleInt" , onInstanceVariables , true ) . SetCategory ( "Postfix operator, ++" ) . Returns ( - 1 ) ;
11421149 yield return new TestCaseData ( "simpleInt--" , onInstanceVariables , true ) . SetCategory ( "Postfix operator, --" ) . Returns ( 42 ) ;
11431150 yield return new TestCaseData ( "simpleInt-- - simpleInt" , onInstanceVariables , true ) . SetCategory ( "Postfix operator, --" ) . Returns ( 1 ) ;
1151+
1152+ yield return new TestCaseData ( "false && 1/0>0" , onInstanceVariables , true ) . SetCategory ( "Conditional And, negative left operand (should respect left associativity)" ) . Returns ( false ) ;
1153+ yield return new TestCaseData ( "true || 1/0>0" , onInstanceVariables , true ) . SetCategory ( "Conditional Or, positive left operand (should respect left associativity)" ) . Returns ( true ) ;
1154+ yield return new TestCaseData ( "false && (true && 1/0>0)" , onInstanceVariables , true ) . SetCategory ( "Conditional And, negative left operand (should respect left associativity)" ) . Returns ( false ) ;
1155+ yield return new TestCaseData ( "true || (false || 1/0>0)" , onInstanceVariables , true ) . SetCategory ( "Conditional Or, positive left operand (should respect left associativity)" ) . Returns ( true ) ;
11441156 #endregion
11451157
11461158 #region Delegates as a variable
@@ -1426,7 +1438,7 @@ public static IEnumerable<TestCaseData> TestCasesForExceptionThrowingEvaluation
14261438 evaluator = new ExpressionEvaluator ( new Dictionary < string , object >
14271439 {
14281440 { "P1var" , "P1" } ,
1429- { "myObj" , new ClassForTest1 ( ) } ,
1441+ { "myObj" , new ClassForTest1 ( ) }
14301442 } ) ;
14311443
14321444 evaluator . PreEvaluateVariable += ( sender , e ) =>
@@ -1446,7 +1458,10 @@ public static IEnumerable<TestCaseData> TestCasesForExceptionThrowingEvaluation
14461458 yield return new TestCaseData ( evaluator , "myObj.PropertyThatWillFailed" , typeof ( ExpressionEvaluatorSyntaxErrorException ) ) . SetCategory ( "OnTheFly canceled Var" ) ;
14471459 yield return new TestCaseData ( evaluator , "myObj.Add3To(5)" , typeof ( ExpressionEvaluatorSyntaxErrorException ) ) . SetCategory ( "OnTheFly canceled Func" ) ;
14481460 yield return new TestCaseData ( evaluator , "Abs(-5)" , typeof ( ExpressionEvaluatorSyntaxErrorException ) ) . SetCategory ( "OnTheFly canceled Func" ) ;
1449-
1461+ yield return new TestCaseData ( evaluator , "true && 1/0>0" , typeof ( DivideByZeroException ) ) . SetCategory ( "Conditional And, positive left operand (should lead to exception)" ) ;
1462+ yield return new TestCaseData ( evaluator , "false || 1/0>0" , typeof ( DivideByZeroException ) ) . SetCategory ( "Conditional Or, positive left operand (should lead to exception associativity)" ) ;
1463+ yield return new TestCaseData ( evaluator , "true && (true && 1/0>0)" , typeof ( DivideByZeroException ) ) . SetCategory ( "Conditional And, positive left operand (should lead to exception)" ) ;
1464+ yield return new TestCaseData ( evaluator , "false || (false || 1/0>0)" , typeof ( DivideByZeroException ) ) . SetCategory ( "Conditional Or, positive left operand (should lead to exception associativity)" ) ;
14501465 #endregion
14511466 }
14521467 }
0 commit comments