/// <summary> /// Binds a binary operator token. /// </summary> /// <param name="binaryOperatorToken">The binary operator token to bind.</param> /// <returns>The bound binary operator token.</returns> internal QueryNode BindBinaryOperator(BinaryOperatorToken binaryOperatorToken) { ExceptionUtils.CheckArgumentNotNull(binaryOperatorToken, "binaryOperatorToken"); SingleValueNode left = this.GetOperandFromToken(binaryOperatorToken.OperatorKind, binaryOperatorToken.Left); SingleValueNode right = this.GetOperandFromToken(binaryOperatorToken.OperatorKind, binaryOperatorToken.Right); BinaryOperatorBinder.PromoteOperandTypes(binaryOperatorToken.OperatorKind, ref left, ref right); return(new BinaryOperatorNode(binaryOperatorToken.OperatorKind, left, right)); }
public void Init() { this.shouldReturnLeft = true; this.binaryOperatorBinder = new BinaryOperatorBinder(this.BindMethodThatReturnsSingleValueQueryNode, /*resolver*/ null); }
public void CollectionRightTokenShouldFail() { this.binaryOperatorBinder = new BinaryOperatorBinder(this.BindMethodThatReturnsQueryNode, /*resolver*/ null); this.leftQueryNode = new ConstantNode("People"); this.rightQueryNode = new EntitySetNode(this.model.FindDeclaredEntitySet("People")); var binaryOperatorToken = new BinaryOperatorToken(BinaryOperatorKind.Equal, new LiteralToken("foo"), new LiteralToken("bar")); Action bind = () => this.binaryOperatorBinder.BindBinaryOperator(binaryOperatorToken); bind.ShouldThrow<ODataException>(). WithMessage((Strings.MetadataBinder_BinaryOperatorOperandNotSingleValue("Equal"))); }
/// <summary> /// Binds a binary operator token. /// </summary> /// <param name="binaryOperatorToken">The binary operator token to bind.</param> /// <returns>The bound binary operator token.</returns> protected virtual QueryNode BindBinaryOperator(BinaryOperatorToken binaryOperatorToken) { BinaryOperatorBinder binaryOperatorBinder = new BinaryOperatorBinder(this.Bind, this.BindingState.Configuration.Resolver); return(binaryOperatorBinder.BindBinaryOperator(binaryOperatorToken)); }
/// <summary> /// Binds a binary operator token. /// </summary> /// <param name="binaryOperatorToken">The binary operator token to bind.</param> /// <returns>The bound binary operator token.</returns> protected virtual QueryNode BindBinaryOperator(BinaryOperatorToken binaryOperatorToken) { BinaryOperatorBinder binaryOperatorBinder = new BinaryOperatorBinder(this.Bind, this.BindingState.Configuration.Resolver); return binaryOperatorBinder.BindBinaryOperator(binaryOperatorToken); }
/// <summary> /// Binds a binary operator token. /// </summary> /// <param name="binaryOperatorToken">The binary operator token to bind.</param> /// <returns>The bound binary operator token.</returns> protected virtual QueryNode BindBinaryOperator(BinaryOperatorToken binaryOperatorToken) { BinaryOperatorBinder binaryOperatorBinder = new BinaryOperatorBinder(this.Bind); return(binaryOperatorBinder.BindBinaryOperator(binaryOperatorToken)); }