public void Update_NoChanges() { var resultWithElse = _caseExpressionWithElse.Update(_caseExpressionWithElse.Cases, _caseExpressionWithElse.ElseCase); var resultWithoutElse = _caseExpressionWithoutElse.Update(_caseExpressionWithoutElse.Cases, _caseExpressionWithoutElse.ElseCase); Assert.That(resultWithElse, Is.SameAs(_caseExpressionWithElse)); Assert.That(resultWithoutElse, Is.SameAs(_caseExpressionWithoutElse)); }
public Expression VisitSqlCase(SqlCaseExpression expression) { ArgumentUtility.CheckNotNull("expression", expression); var newCases = Visit( expression.Cases, caseWhenPair => { var newWhen = ApplyPredicateContext(caseWhenPair.When); var newThen = ApplySingleValueContext(caseWhenPair.Then); return(caseWhenPair.Update(newWhen, newThen)); }); var newElseCase = expression.ElseCase != null?ApplySingleValueContext(expression.ElseCase) : null; return(expression.Update(newCases, newElseCase)); }