public void HandleResultOperator_WithMatchingTypes ()
    {
      var sqlStatementBuilder = CreateSqlStatementBuilder (typeof (decimal));

      var averageResultOperator = new AverageResultOperator ();
      Assert.That (averageResultOperator.GetOutputDataInfo (sqlStatementBuilder.DataInfo).DataType, Is.SameAs (typeof (decimal)));

      var previousSelectExpression = sqlStatementBuilder.SelectProjection;

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

      Assert.That (sqlStatementBuilder.SelectProjection, Is.TypeOf<AggregationExpression> ());
      Assert.That (((AggregationExpression) sqlStatementBuilder.SelectProjection).AggregationModifier, Is.EqualTo (AggregationModifier.Average));
      Assert.That (((AggregationExpression) sqlStatementBuilder.SelectProjection).Expression, Is.SameAs (previousSelectExpression));

      Assert.That (sqlStatementBuilder.DataInfo, Is.TypeOf (typeof (StreamedScalarValueInfo)));
      Assert.That (((StreamedScalarValueInfo) sqlStatementBuilder.DataInfo).DataType, Is.EqualTo (typeof (decimal)));
    }
Esempio n. 2
0
        public void HandleResultOperator_WithMatchingTypes()
        {
            var sqlStatementBuilder = CreateSqlStatementBuilder(typeof(decimal));

            var averageResultOperator = new AverageResultOperator();

            Assert.That(averageResultOperator.GetOutputDataInfo(sqlStatementBuilder.DataInfo).DataType, Is.SameAs(typeof(decimal)));

            var previousSelectExpression = sqlStatementBuilder.SelectProjection;

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

            Assert.That(sqlStatementBuilder.SelectProjection, Is.TypeOf <AggregationExpression> ());
            Assert.That(((AggregationExpression)sqlStatementBuilder.SelectProjection).AggregationModifier, Is.EqualTo(AggregationModifier.Average));
            Assert.That(((AggregationExpression)sqlStatementBuilder.SelectProjection).Expression, Is.SameAs(previousSelectExpression));

            Assert.That(sqlStatementBuilder.DataInfo, Is.TypeOf(typeof(StreamedScalarValueInfo)));
            Assert.That(((StreamedScalarValueInfo)sqlStatementBuilder.DataInfo).DataType, Is.EqualTo(typeof(decimal)));
        }
 public void SetUp ()
 {
   _resultOperator = new AverageResultOperator ();
 }
Esempio n. 4
0
 public void SetUp()
 {
     _resultOperator = new AverageResultOperator();
 }