Пример #1
0
        public async void TestReadAsync()
        {
            blocks.Position = 0;
            master.Position = 0;

            do
            {
                int nread = await blocks.ReadAsync(buf, 0, buf.Length);

                int mread = await master.ReadAsync(mbuf, 0, mbuf.Length);

                Assert.AreEqual(mread, nread, "Did not read the expected number of bytes from the memory block stream");
                Assert.AreEqual(master.Position, blocks.Position, "The memory block stream's position did not match");

                for (int i = 0; i < mread; i++)
                {
                    Assert.AreEqual(mbuf[i], buf[i], "The bytes read do not match");
                }
            } while (master.Position < master.Length);
        }