Пример #1
0
        public void Iterators_Sort_Sorts_WithOuterEntries()
        {
            var rows     = new object[] { null, 1, 2, 1 };
            var expected = new object[] { null, 1, 1, 2 };

            var outerRowBuffer = new MockedRowBuffer(new object[] { "Outer Reference" });

            using (var input = new MockedIterator(rows))
            {
                var sortEntries = new[]
                {
                    new RowBufferEntry(outerRowBuffer, 0),
                    new RowBufferEntry(input.RowBuffer, 0)
                };

                var comparers = new[]
                {
                    Comparer.Default,
                    Comparer.Default
                };

                using (var iterator = new SortIterator(input, sortEntries, comparers))
                {
                    AssertProduces(iterator, expected);
                }
            }
        }
Пример #2
0
        public MockedIterator(object[] rows)
        {
            if (rows.Any(v => v is object[]))
            {
                throw new ArgumentException("Nested array detected. Use two-dimensional array for multiple columns.");
            }

            _rows      = rows.Select(v => new[] { v }).ToArray();
            _rowBuffer = new MockedRowBuffer(1);
        }
Пример #3
0
        public MockedIterator(object[,] rows)
        {
            var rowCount   = rows.GetLength(0);
            var entryCount = rows.GetLength(1);

            var rowArray = new object[rowCount][];

            for (var i = 0; i < rowCount; i++)
            {
                rowArray[i] = new object[entryCount];

                for (var j = 0; j < entryCount; j++)
                {
                    rowArray[i][j] = rows[i, j];
                }
            }

            _rows      = rowArray;
            _rowBuffer = new MockedRowBuffer(entryCount);
        }