public void ReadRowsInSecondScanDoNotUseOriginalReaderForEmptyRowsArray()
        {
            // arrange
            const int    rows    = 0;
            const int    columns = 0;
            const double density = 0.01;

            var originalVectors            = SparseVectorHelper.GenerateSparseVectors(rows, columns, density, () => SparseVectorHelper.RandomInInterval(-100, 100, 2)).ToArray();
            var originalReader             = new InMemorySparseMatrixReader(originalVectors);
            var originalReaderWithCounters = new SparseMatrixReaderWithMemberInvocationCounters <double>(originalReader);

            using (var cachedReader = new CachedMatrixMarketReader <double>(originalReaderWithCounters))
            {
                // act
                foreach (var row in cachedReader.ReadRows())
                {
                }
                foreach (var row in cachedReader.ReadRows())
                {
                }

                // assert
                Assert.AreEqual(1, originalReaderWithCounters.ColumnsCountInvocations);
                Assert.AreEqual(1, originalReaderWithCounters.RowsCountInvocations);
                Assert.AreEqual(1, originalReaderWithCounters.ElementsCountInvocations);
                Assert.AreEqual(1, originalReaderWithCounters.ReadRowsInvocations);
            }
        }
        public void ReadRowsReturnSameVectorsInSecondScanForEmptyRowsArray()
        {
            // arrange
            const int    rows    = 0;
            const int    columns = 0;
            const double density = 0.01;

            var originalVectors = SparseVectorHelper.GenerateSparseVectors(rows, columns, density, () => SparseVectorHelper.RandomInInterval(-100, 100, 2)).ToArray();
            var originalReader  = new InMemorySparseMatrixReader(originalVectors);

            using (var cachedReader = new CachedMatrixMarketReader <double>(originalReader))
            {
                // act
                foreach (var row in cachedReader.ReadRows())
                {
                }
                var secondScanResults = originalReader.ReadRows().ZipFull(cachedReader.ReadRows(), (originalVector, cachedVector) => originalVector == cachedVector).All(b => b);

                // assert
                Assert.IsTrue(secondScanResults);
            }
        }