Exemplo n.º 1
0
        private AggregateStatement BindAggregateStatementToken(AggregateStatementToken token)
        {
            var expression = this.bindMethod(token.Expression) as SingleValueNode;

            if (expression == null)
            {
                throw new ODataException(ODataErrorStrings.ApplyBinder_AggregateStatementNotSingleValue(token.Expression));
            }

            var typeReference = CreateAggregateStatementTypeReference(expression, token.WithVerb);

            // TODO: Determine source
            return(new AggregateStatement(expression, token.WithVerb, null, token.AsAlias, typeReference));
        }
Exemplo n.º 2
0
        private AggregateStatement BindAggregateStatementToken(AggregateStatementToken token)
        {
            var expression = this.bindMethod(token.Expression) as SingleValueNode;

            if (expression == null)
            {
                throw new ODataException(ODataErrorStrings.ApplyBinder_AggregateStatementNotSingleValue(token.Expression));
            }

            var typeReference = CreateAggregateStatementTypeReference(expression, token.WithVerb);

            // TODO: Determine source
            return new AggregateStatement(expression, token.WithVerb, null, token.AsAlias, typeReference);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Visits an AggregateStatementToken
 /// </summary>
 /// <param name="tokenIn">The AggregateStatementToken to visit</param>
 /// <returns>A T bound to this AggregateStatementToken</returns>
 public virtual T Visit(AggregateStatementToken tokenIn)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 4
0
        private static void VerifyAggregateStatementToken(string expectedEndPathIdentifier, AggregationVerb expectedVerb, string expectedAlias, AggregateStatementToken actual)
        {
            actual.Expression.Should().NotBeNull();

            var expression = actual.Expression as EndPathToken;

            expression.Should().NotBeNull();
            expression.Identifier.Should().Be(expectedEndPathIdentifier);

            actual.WithVerb.Should().Be(expectedVerb);
            actual.AsAlias.Should().Be(expectedAlias);
        }
 public void KindIsSetCorrectly()
 {
     var token = new AggregateStatementToken(expressionToken, AggregationVerb.CountDistinct, "Alias");
     token.Kind.Should().Be(QueryTokenKind.AggregateStatement);
 }
 public void WithVerbSetCorrectly()
 {
     var token = new AggregateStatementToken(expressionToken, AggregationVerb.CountDistinct, "Alias");
     token.WithVerb.Should().Be(AggregationVerb.CountDistinct);
 }
 public void AliasSetCorrectly()
 {
     var token = new AggregateStatementToken(expressionToken, AggregationVerb.CountDistinct, "Alias");
     token.AsAlias.Should().BeEquivalentTo("Alias");
 }
 public void ExpressionSetCorrectly()
 {
     var token = new AggregateStatementToken(expressionToken, AggregationVerb.Sum, "Alias");
     token.Expression.Should().Be(expressionToken);
 }
Exemplo n.º 9
0
        public void KindIsSetCorrectly()
        {
            var token = new AggregateStatementToken(expressionToken, AggregationVerb.CountDistinct, "Alias");

            token.Kind.Should().Be(QueryTokenKind.AggregateStatement);
        }
Exemplo n.º 10
0
        public void AliasSetCorrectly()
        {
            var token = new AggregateStatementToken(expressionToken, AggregationVerb.CountDistinct, "Alias");

            token.AsAlias.Should().BeEquivalentTo("Alias");
        }
Exemplo n.º 11
0
        public void WithVerbSetCorrectly()
        {
            var token = new AggregateStatementToken(expressionToken, AggregationVerb.CountDistinct, "Alias");

            token.WithVerb.Should().Be(AggregationVerb.CountDistinct);
        }
Exemplo n.º 12
0
        public void ExpressionSetCorrectly()
        {
            var token = new AggregateStatementToken(expressionToken, AggregationVerb.Sum, "Alias");

            token.Expression.Should().Be(expressionToken);
        }