private static void Main()
        {
            int len = 504;

            Console.WriteLine("Start");
            var t = new Test(len);
            t.Fill();
            t.RandomRemove(10);
            t.RandomReverse2(15);

            var th = new Thread(t.ReadThreadStart);
            th.Start();
            t.Write();
            th.Join();
            t.Compare();
            Console.WriteLine("Finish");
        }
Exemplo n.º 2
0
        public void TestMemStream()
        {
            Test s = new Test(new MemoryStream());

            Assert.IsTrue(s.CanRead);
            Assert.IsTrue(s.CanWrite);
            Assert.IsTrue(s.CanSeek);
            Assert.IsFalse(s.CanTimeout);

            Assert.AreEqual(0L, s.Position);
            Assert.AreEqual(0L, s.Length);

            s.Write(new byte[1], 0, 1);
            Assert.AreEqual(0, s.Read(new byte[1], 0, 1));

            Assert.AreEqual(1L, s.Position);
            s.Position = 0;
            Assert.AreEqual(1, s.Read(new byte[10], 0, 10));
            Assert.AreEqual(1L, s.Position);

            s.Seek(0, SeekOrigin.Begin);
            Assert.AreEqual(0L, s.Position);

            Assert.AreEqual(1L, s.Length);
            s.SetLength(20);
            Assert.AreEqual(20L, s.Length);
            
            s.Flush();
            s.Close();
            s.Dispose();
        }