public void HandleResultOperator_WithOrderingsWithoutTopExpression ()
    {
      _sqlStatementBuilder.Orderings.Add (new Ordering (Expression.Constant ("order"), OrderingDirection.Asc));
      var averageResultOperator = new MaxResultOperator ();

      _handler.HandleResultOperator (averageResultOperator, _sqlStatementBuilder, _generator, _stage, _context);

      Assert.That (_sqlStatementBuilder.Orderings.Count, Is.EqualTo (0));
    }
        public void HandleResultOperator_WithOrderingsWithoutTopExpression()
        {
            _sqlStatementBuilder.Orderings.Add(new Ordering(Expression.Constant("order"), OrderingDirection.Asc));
            var averageResultOperator = new MaxResultOperator();

            _handler.HandleResultOperator(averageResultOperator, _sqlStatementBuilder, UniqueIdentifierGenerator, _stage, _context);

            Assert.That(_sqlStatementBuilder.Orderings.Count, Is.EqualTo(0));
        }
        public void HandleResultOperator_AfterTopExpression_CreatesSubstatement()
        {
            _sqlStatementBuilder.TopExpression = Expression.Constant("top");

            var resultOperator = new MaxResultOperator();

            _handler.HandleResultOperator(resultOperator, _sqlStatementBuilder, UniqueIdentifierGenerator, _stage, _context);

            AssertStatementWasMovedToSubStatement(_sqlStatementBuilder);
        }
        public void HandleResultOperator()
        {
            var averageResultOperator = new MaxResultOperator();

            _handler.HandleResultOperator(averageResultOperator, _sqlStatementBuilder, UniqueIdentifierGenerator, _stage, _context);

            Assert.That(((AggregationExpression)_sqlStatementBuilder.SelectProjection).AggregationModifier, Is.EqualTo(AggregationModifier.Max));
            Assert.That(_sqlStatementBuilder.DataInfo, Is.TypeOf(typeof(StreamedSingleValueInfo)));
            Assert.That(((StreamedSingleValueInfo)_sqlStatementBuilder.DataInfo).DataType, Is.EqualTo(typeof(int)));
        }
        public void HandleResultOperator_AfterSetOperation_CreatesSubStatement()
        {
            _sqlStatementBuilder.SetOperationCombinedStatements.Add(SqlStatementModelObjectMother.CreateSetOperationCombinedStatement());

            var resultOperator = new MaxResultOperator();

            _handler.HandleResultOperator(resultOperator, _sqlStatementBuilder, UniqueIdentifierGenerator, _stage, _context);

            AssertStatementWasMovedToSubStatement(_sqlStatementBuilder);
        }
        public void HandleResultOperator_AfterDistinctExpression_CreatesSubStatement()
        {
            _sqlStatementBuilder.IsDistinctQuery = true;

            var resultOperator = new MaxResultOperator();

            _handler.HandleResultOperator(resultOperator, _sqlStatementBuilder, UniqueIdentifierGenerator, _stage, _context);

            AssertStatementWasMovedToSubStatement(_sqlStatementBuilder);
        }
    public void HandleResultOperator ()
    {
      var averageResultOperator = new MaxResultOperator ();

      _handler.HandleResultOperator (averageResultOperator, _sqlStatementBuilder, _generator, _stage, _context);

      Assert.That (((AggregationExpression) _sqlStatementBuilder.SelectProjection).AggregationModifier, Is.EqualTo (AggregationModifier.Max));
      Assert.That (_sqlStatementBuilder.DataInfo, Is.TypeOf (typeof (StreamedSingleValueInfo)));
      Assert.That (((StreamedSingleValueInfo) _sqlStatementBuilder.DataInfo).DataType, Is.EqualTo (typeof (int)));
    }
コード例 #8
0
        public void HandleResultOperator_AfterTopExpression_CreatesSubstatement()
        {
            _sqlStatementBuilder.TopExpression = Expression.Constant("top");

            var resultOperator = new MaxResultOperator();

            _handler.HandleResultOperator(resultOperator, _sqlStatementBuilder, _generator, _stage, _context);

            Assert.That(_sqlStatementBuilder.SqlTables.Count, Is.EqualTo(1));
            Assert.That(((SqlTable)_sqlStatementBuilder.SqlTables[0]).TableInfo, Is.TypeOf(typeof(ResolvedSubStatementTableInfo)));
        }
コード例 #9
0
        public void HandleResultOperator_AfterDistinctExpression_CreatesSubStatement()
        {
            _sqlStatementBuilder.IsDistinctQuery = true;

            var resultOperator = new MaxResultOperator();

            _handler.HandleResultOperator(resultOperator, _sqlStatementBuilder, _generator, _stage, _context);

            Assert.That(_sqlStatementBuilder.SqlTables.Count, Is.EqualTo(1));
            Assert.That(((SqlTable)_sqlStatementBuilder.SqlTables[0]).TableInfo, Is.TypeOf(typeof(ResolvedSubStatementTableInfo)));
            Assert.That(
                ((SqlTable)((SqlTableReferenceExpression)((AggregationExpression)_sqlStatementBuilder.SelectProjection).Expression).SqlTable).TableInfo,
                Is.TypeOf(typeof(ResolvedSubStatementTableInfo)));
        }
    public void HandleResultOperator_WithOrderingsAndTopExpression ()
    {
      _sqlStatementBuilder.TopExpression = Expression.Constant ("top");
      var ordering = new Ordering (Expression.Constant ("order"), OrderingDirection.Asc);
      _sqlStatementBuilder.Orderings.Add (ordering);
      var averageResultOperator = new MaxResultOperator ();

      _handler.HandleResultOperator (averageResultOperator, _sqlStatementBuilder, _generator, _stage, _context);

      Assert.That (_sqlStatementBuilder.Orderings.Count, Is.EqualTo (0));
      Assert.That (
          ((ResolvedSubStatementTableInfo) ((SqlTable) _sqlStatementBuilder.SqlTables[0]).TableInfo).SqlStatement.Orderings.Count, Is.EqualTo (1));
      Assert.That (
          ((ResolvedSubStatementTableInfo) ((SqlTable) _sqlStatementBuilder.SqlTables[0]).TableInfo).SqlStatement.Orderings[0], Is.SameAs(ordering));
    }
コード例 #11
0
        public void HandleResultOperator_WithOrderingsAndTopExpression()
        {
            _sqlStatementBuilder.TopExpression = Expression.Constant("top");
            var ordering = new Ordering(Expression.Constant("order"), OrderingDirection.Asc);

            _sqlStatementBuilder.Orderings.Add(ordering);
            var averageResultOperator = new MaxResultOperator();

            _handler.HandleResultOperator(averageResultOperator, _sqlStatementBuilder, UniqueIdentifierGenerator, _stage, _context);

            Assert.That(_sqlStatementBuilder.Orderings.Count, Is.EqualTo(0));
            Assert.That(
                ((ResolvedSubStatementTableInfo)_sqlStatementBuilder.SqlTables[0].TableInfo).SqlStatement.Orderings.Count, Is.EqualTo(1));
            Assert.That(
                ((ResolvedSubStatementTableInfo)_sqlStatementBuilder.SqlTables[0].TableInfo).SqlStatement.Orderings[0], Is.SameAs(ordering));
        }
コード例 #12
0
 public void SetUp()
 {
     _resultOperator = new MaxResultOperator();
 }
    public void HandleResultOperator_AfterTopExpression_CreatesSubstatement ()
    {
      _sqlStatementBuilder.TopExpression = Expression.Constant ("top");

      var resultOperator = new MaxResultOperator ();

      _handler.HandleResultOperator (resultOperator, _sqlStatementBuilder, _generator, _stage, _context);

      Assert.That (_sqlStatementBuilder.SqlTables.Count, Is.EqualTo (1));
      Assert.That (((SqlTable) _sqlStatementBuilder.SqlTables[0]).TableInfo, Is.TypeOf (typeof (ResolvedSubStatementTableInfo)));
    }
    public void HandleResultOperator_AfterDistinctExpression_CreatesSubStatement ()
    {
      _sqlStatementBuilder.IsDistinctQuery = true;

      var resultOperator = new MaxResultOperator ();

      _handler.HandleResultOperator (resultOperator, _sqlStatementBuilder, _generator, _stage, _context);

      Assert.That (_sqlStatementBuilder.SqlTables.Count, Is.EqualTo (1));
      Assert.That (((SqlTable) _sqlStatementBuilder.SqlTables[0]).TableInfo, Is.TypeOf (typeof (ResolvedSubStatementTableInfo)));
      Assert.That (
          ((SqlTable) ((SqlTableReferenceExpression) ((AggregationExpression) _sqlStatementBuilder.SelectProjection).Expression).SqlTable).TableInfo,
          Is.TypeOf (typeof (ResolvedSubStatementTableInfo)));
    }
コード例 #15
0
 private void HandleMax(SubQueryExpression subquery, MaxResultOperator ro) =>
 HandleArrayFunc(subquery, "ARRAY_MAX()");
コード例 #16
0
 public void SetUp ()
 {
   _resultOperator = new MaxResultOperator ();
 }