public void NestedComputeAndSelectIsAllowed() { var result = this.ParseExpandOptions("($compute=Price mul Qty as TotalPrice;$select=Name,Qty,TotalPrice)"); result.Should().NotBeNull(); ComputeToken compute = result.ComputeOption; compute.Should().NotBeNull(); compute.Expressions.Should().NotBeNull(); compute.Expressions.Should().HaveCount(1); ComputeExpressionToken computeExpressionToken = result.ComputeOption.Expressions.Single(); computeExpressionToken.Alias.Should().Equals("TotalPrice"); BinaryOperatorToken binaryOperatorToken = computeExpressionToken.Expression.ShouldBeBinaryOperatorQueryToken(BinaryOperatorKind.Multiply); binaryOperatorToken.Left.ShouldBeEndPathToken("Price"); binaryOperatorToken.Right.ShouldBeEndPathToken("Qty"); IEnumerable <PathSegmentToken> selectTerms = result.SelectOption.Properties; selectTerms.Should().HaveCount(3); selectTerms.ElementAt(0).ShouldBeNonSystemToken("Name"); selectTerms.ElementAt(1).ShouldBeNonSystemToken("Qty"); selectTerms.ElementAt(2).ShouldBeNonSystemToken("TotalPrice"); }
public void NestedComputeIsAllowed() { var result = this.ParseExpandOptions("($compute=Price mul Qty as TotalPrice)"); result.Should().NotBeNull(); ComputeToken compute = result.ComputeOption; compute.Should().NotBeNull(); compute.Expressions.Should().NotBeNull(); compute.Expressions.Should().HaveCount(1); ComputeExpressionToken computeExpressionToken = result.ComputeOption.Expressions.Single(); computeExpressionToken.Alias.Should().Equals("TotalPrice"); BinaryOperatorToken binaryOperatorToken = computeExpressionToken.Expression.ShouldBeBinaryOperatorQueryToken(BinaryOperatorKind.Multiply); binaryOperatorToken.Left.ShouldBeEndPathToken("Price"); binaryOperatorToken.Right.ShouldBeEndPathToken("Qty"); }