Lucene.Net.Index.TestCompoundFile.AssertSameStreams C# (CSharp) Method

AssertSameStreams() private method

private AssertSameStreams ( string msg, IndexInput expected, IndexInput test ) : void
msg string
expected Lucene.Net.Store.IndexInput
test Lucene.Net.Store.IndexInput
return void
        private void AssertSameStreams(string msg, IndexInput expected, IndexInput test)
        {
            Assert.IsNotNull(expected, msg + " null expected");
            Assert.IsNotNull(test, msg + " null test");
            Assert.AreEqual(expected.Length(), test.Length(), msg + " length");
            Assert.AreEqual(expected.FilePointer, test.FilePointer, msg + " position");

            var expectedBuffer = new byte[512];
            var testBuffer = new byte[expectedBuffer.Length];

            long remainder = expected.Length() - expected.FilePointer;
            while (remainder > 0)
            {
                int readLen = (int)Math.Min(remainder, expectedBuffer.Length);
                expected.ReadBytes(expectedBuffer, 0, readLen);
                test.ReadBytes(testBuffer, 0, readLen);
                AssertEqualArrays(msg + ", remainder " + remainder, expectedBuffer, testBuffer, 0, readLen);
                remainder -= readLen;
            }
        }

Same methods

TestCompoundFile::AssertSameStreams ( string msg, IndexInput expected, IndexInput actual, long seekTo ) : void