public void TestNullEvaluate()
        {
            var expression = new NullCoalescingExpression(
                Mock.Of <IExpression>(e => e.Evaluate(It.IsAny <IDictionary <string, object> >()) == (object)null),
                Mock.Of <IExpression>(e => e.Evaluate(It.IsAny <IDictionary <string, object> >()) == (object)"Now used"),
                ExpressiveOptions.None);

            Assert.AreEqual("Now used", expression.Evaluate(null));
        }
        /// <summary>
        /// Reads a null coalescing expression.
        /// </summary>
        /// <param name="leftHandSide">The expression on the left hand side of the operator.</param>
        /// <param name="previousPrecedence">The precedence of the expression just before this one.</param>
        /// <param name="unsafeCode">Indicates whether the code being parsed resides in an unsafe code block.</param>
        /// <returns>Returns the expression.</returns>
        private NullCoalescingExpression GetNullCoalescingExpression(
            Expression leftHandSide, ExpressionPrecedence previousPrecedence, bool unsafeCode)
        {
            Param.AssertNotNull(leftHandSide, "leftHandSide");
            Param.Ignore(previousPrecedence);
            Param.Ignore(unsafeCode);

            NullCoalescingExpression expression = null;

            // Read the details of the expression.
            OperatorSymbol operatorToken = this.PeekOperatorToken();
            Debug.Assert(operatorToken.SymbolType == OperatorType.NullCoalescingSymbol, "Expected a null-coalescing symbol");

            // Check the precedence of the operators to make sure we can gather this statement now.
            ExpressionPrecedence precedence = this.GetOperatorPrecedence(operatorToken.SymbolType);
            if (this.CheckPrecedence(previousPrecedence, precedence))
            {
                // Add the operator token to the document and advance the symbol manager up to it.
                this.symbols.Advance();
                this.tokens.Add(operatorToken);

                // Get the expression on the right-hand side of the operator.
                Expression rightHandSide = this.GetOperatorRightHandExpression(precedence, unsafeCode);

                // Create the partial token list for the expression.
                CsTokenList partialTokens = new CsTokenList(this.tokens, leftHandSide.Tokens.First, this.tokens.Last);

                // Create and return the expression.
                expression = new NullCoalescingExpression(partialTokens, leftHandSide, rightHandSide);
            }

            return expression;
        }