diff --git a/ICSharpCode.NRefactory.Tests/CSharp/InsertParenthesesVisitorTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/InsertParenthesesVisitorTests.cs index 1415ca3f38..fd044068fd 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/InsertParenthesesVisitorTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/InsertParenthesesVisitorTests.cs @@ -108,6 +108,27 @@ namespace ICSharpCode.NRefactory.CSharp Assert.AreEqual("-(-a)", InsertReadable(expr)); } + [Test] + public void AdditionWithConditional() + { + Expression expr = new BinaryOperatorExpression { + Left = new IdentifierExpression("a"), + Operator = BinaryOperatorType.Add, + Right = new ConditionalExpression { + Condition = new BinaryOperatorExpression { + Left = new IdentifierExpression("b"), + Operator = BinaryOperatorType.Equality, + Right = new PrimitiveExpression(null) + }, + TrueExpression = new IdentifierExpression("c"), + FalseExpression = new IdentifierExpression("d") + } + }; + + Assert.AreEqual("a + (b == null ? c : d)", InsertRequired(expr)); + Assert.AreEqual("a + ((b == null) ? c : d)", InsertReadable(expr)); + } + [Test] public void TypeTestInConditional() {