public void ExecuteInMemory ()
    {
      IStreamedData input = new StreamedSequence (new[] { 1, 2, 3 }, new StreamedSequenceInfo (typeof (int[]), Expression.Constant (0)));
      var result = _resultOperator.ExecuteInMemory (input);

      Assert.That (result, Is.SameAs (input));
    }
    public void SetUp ()
    {
      _stringExpression = Expression.Constant (0);
      _stringSequence = new[] { "a", "b", "c" };

      _dataWithCovariantSequence = new StreamedSequence (_stringSequence, new StreamedSequenceInfo (typeof (object[]), _stringExpression));
    }
    public void ExecuteInMemory ()
    {
      var input = new StreamedSequence (new[] { 1, 2, 3 }, new StreamedSequenceInfo (typeof (int[]), Expression.Constant (0)));
      var result = _resultOperator.ExecuteInMemory<int> (input);

      Assert.That (result.Value, Is.EqualTo (3));
    }
    public void ExecuteInMemory ()
    {
      var items = new[] { 1, 2, 3 };
      var input = new StreamedSequence (items, new StreamedSequenceInfo (typeof (int[]), Expression.Constant (0)));
      var result = _resultOperator.ExecuteInMemory<int> (input);

      Assert.That (result.GetTypedSequence<int>().ToArray(), Is.EquivalentTo (new[] { 1, 2, 3 }));
    }
    public void ExecuteInMemory_WithDefaultValue ()
    {
      IEnumerable items = new int[0];
      var input = new StreamedSequence (items, new StreamedSequenceInfo (typeof (int[]), Expression.Constant (0)));
      var result = _resultOperatorWithDefaultValue.ExecuteInMemory<int> (input);

      Assert.That (result.GetTypedSequence<int>().ToArray(), Is.EqualTo (new[] { 100 }));
    }
    public void ExecuteInMemory_Empty_Default ()
    {
      IEnumerable items = new int[0];
      var input = new StreamedSequence (items, new StreamedSequenceInfo (typeof (int[]), Expression.Constant (0)));
      var result = _resultOperatorWithDefault.ExecuteInMemory (input);

      Assert.That (result.Value, Is.EqualTo (0));
    }
    public void ExecuteInMemory ()
    {
      IEnumerable items = new[] { 1, 2, 3, 4 };
      var input = new StreamedSequence (items, new StreamedSequenceInfo (typeof (int[]), Expression.Constant (0)));
      var result = _resultOperator.ExecuteInMemory<int> (input);

      Assert.That (result.Value, Is.True);
    }
    public void ExecuteInMemory ()
    {
      var student1 = new Chef ();
      var student2 = new Chef ();
      IEnumerable items = new Cook[] { student1, student2 };
      var itemExpression = Expression.Constant (student1, typeof (Cook));
      var input = new StreamedSequence (items, new StreamedSequenceInfo (typeof (Cook[]), itemExpression));

      var result = _resultOperator.ExecuteInMemory<Cook> (input);

      var sequence = result.GetTypedSequence<Chef>();
      Assert.That (sequence.ToArray (), Is.EquivalentTo (new[] { student1, student2 }));
      Assert.That (result.DataInfo.ResultItemType, Is.EqualTo (typeof (Chef)));
      Assert.That (((UnaryExpression) result.DataInfo.ItemExpression).Operand, Is.SameAs (itemExpression));
    }
Exemple #9
0
 /// <summary>
 ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
 ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
 ///     any release. You should only use it directly in your code with extreme caution and knowing that
 ///     doing so can result in application failures when updating to a new Entity Framework Core release.
 /// </summary>
 public override StreamedSequence ExecuteInMemory <T>(StreamedSequence input) => input;
 public override StreamedSequence ExecuteInMemory <T>(StreamedSequence input)
 {
     return(input); // sequence is not changed by this operator
 }
    public void ExecuteInMemory ()
    {
      // group [i].ToString() by [j] % 3
      // expected input: new AnonymousType ( a = [i], b = [j] )

      var expectedInput = Expression.New (
        typeof (AnonymousType).GetConstructor (new[] {typeof (int), typeof (int) }), 
        new Expression[] { new QuerySourceReferenceExpression (_fromClause1), new QuerySourceReferenceExpression (_fromClause2) },
        new MemberInfo[] { typeof (AnonymousType).GetProperty ("a"), typeof (AnonymousType).GetProperty ("b") });

      var items = new[] { 
          new AnonymousType (111, 1), 
          new AnonymousType (222, 2), 
          new AnonymousType (333, 3), 
          new AnonymousType (444, 4), 
          new AnonymousType (555, 5) 
      };

      var input = new StreamedSequence (items, new StreamedSequenceInfo (typeof (AnonymousType[]), expectedInput));

      var result = _resultOperator.ExecuteInMemory<AnonymousType> (input);
      var sequence = result.GetTypedSequence<IGrouping<int, string>> ();

      var resultArray = sequence.ToArray ();
      Assert.That (resultArray.Length, Is.EqualTo (3));
      Assert.That (resultArray[0].ToArray (), Is.EqualTo (new[] { "111", "444" }));
      Assert.That (resultArray[1].ToArray (), Is.EqualTo (new[] { "222", "555" }));
      Assert.That (resultArray[2].ToArray (), Is.EqualTo (new[] { "333" }));

      Assert.That (result.DataInfo.ItemExpression, Is.InstanceOf (typeof (QuerySourceReferenceExpression)));
      Assert.That (((QuerySourceReferenceExpression) result.DataInfo.ItemExpression).ReferencedQuerySource, Is.SameAs (_resultOperator));
    }
 public void SetUp()
 {
     _resultOperator       = new TestResultOperator();
     _executeInMemoryInput = new StreamedSequence(new[] { 1, 2, 3, 4, 3, 2, 1 }, new StreamedSequenceInfo(typeof(int[]), Expression.Constant(0)));
 }
 public void ExecuteInMemory_UnsupportedType ()
 {
   var input = new StreamedSequence (new[] { "1", "2", "3" }, new StreamedSequenceInfo (typeof (string[]), Expression.Constant ("0")));
   _resultOperator.ExecuteInMemory<string> (input);
 }
 public abstract StreamedSequence ExecuteInMemory <T> (StreamedSequence input);
Exemple #15
0
        public override StreamedSequence ExecuteInMemory <T>([NotNull] StreamedSequence input)
        {
            Check.NotNull(input, "input");

            return(input);
        }
 public override StreamedValue ExecuteInMemory <T>(StreamedSequence input)
 {
     throw new NotImplementedException("Cannot explain N1QL queries in memory");
 }
Exemple #17
0
 public abstract AsyncStreamedValue ExecuteInMemory <T>(StreamedSequence sequence);
Exemple #18
0
 /// <summary>
 /// Run the operation in memory.
 /// WARNING: This is not supported, and will bomb.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="sequence"></param>
 /// <returns></returns>
 public override StreamedValue ExecuteInMemory <T>(StreamedSequence sequence)
 {
     throw new NotImplementedException("The result operator AsCSV can't be executed in memory currently.");
 }
 public void ExecuteInMemory_TooManyItems ()
 {
   IEnumerable items = new[] { 1, 2 };
   var input = new StreamedSequence (items, new StreamedSequenceInfo (typeof (int[]), Expression.Constant (0)));
   _resultOperatorWithDefault.ExecuteInMemory (input);
 }
 public override StreamedValue ExecuteInMemory <T> (StreamedSequence sequence)
 {
     return(new StreamedValue(sequence.GetTypedSequence <T> ().First(), GetOutputDataInfo(sequence.DataInfo)));
 }
 public void SetUp ()
 {
   _resultOperator = new TestResultOperator ();
   _executeInMemoryInput = new StreamedSequence (new[] { 1, 2, 3, 4, 3, 2, 1 }, new StreamedSequenceInfo (typeof (int[]), Expression.Constant (0)));
 }
        /// <inheritdoc cref="ResultOperatorBase.ExecuteInMemory" />
        public override StreamedValue ExecuteInMemory <TInput>(StreamedSequence input)
        {
            var closedExecuteMethod = s_executeMethod.MakeGenericMethod(typeof(TInput), Seed.Type, GetResultType());

            return((StreamedValue)InvokeExecuteMethod(closedExecuteMethod, input));
        }
 public void ExecuteInMemory_Empty_NoDefault ()
 {
   IEnumerable items = new int[0];
   var input = new StreamedSequence (items, new StreamedSequenceInfo (typeof (int[]), Expression.Constant (0)));
   _resultOperatorNoDefault.ExecuteInMemory (input);
 }
        public override StreamedSequence ExecuteInMemory <T> (StreamedSequence input)
        {
            var sequenceInfo = input.GetTypedSequence <T> ();

            return(new StreamedSequence(sequenceInfo.Distinct().AsQueryable(), (StreamedSequenceInfo)GetOutputDataInfo(input.DataInfo)));
        }
Exemple #25
0
        public void ExecuteInMemory_UnsupportedType()
        {
            var input = new StreamedSequence(new[] { "1", "2", "3" }, new StreamedSequenceInfo(typeof(string[]), Expression.Constant("0")));

            _resultOperator.ExecuteInMemory <string> (input);
        }
Exemple #26
0
 public override StreamedValue ExecuteInMemory <T>(StreamedSequence sequence)
 {
     throw new NotSupportedException("UpdateAll is not supported for in-memory sequences.");
 }
    public void ExecuteInMemory_WithoutResultSelector ()
    {
      IEnumerable items = new[] { 1, 2, 3, 4 };
      var input = new StreamedSequence (items, new StreamedSequenceInfo (typeof (int[]), _sourceExpression));
      var result = _resultOperatorWithoutResultSelector.ExecuteInMemory<int> (input);

      Assert.That (result.Value, Is.EqualTo (22));
    }
 public override StreamedSequence ExecuteInMemory <T> (StreamedSequence input)
 {
     ArgumentUtility.CheckNotNull("input", input);
     return(input);
 }
Exemple #29
0
 /// <summary>
 ///     This API supports the Entity Framework Core infrastructure and is not intended to be used
 ///     directly from your code. This API may change or be removed in future releases.
 /// </summary>
 public override StreamedSequence ExecuteInMemory <T>(StreamedSequence input)
 {
     return(input);
 }
Exemple #30
0
        public override StreamedSequence ExecuteInMemory <TInput>(StreamedSequence input)
        {
            var closedExecuteMethod = s_executeMethod.MakeGenericMethod(typeof(TInput), KeySelector.Type, ElementSelector.Type);

            return((StreamedSequence)InvokeExecuteMethod(closedExecuteMethod, input));
        }