public void ReadWriteBytesTest()
        {
            MemoryStream ms = new MemoryStream();
            // serialize some data
            XmlWriterMock writer = new XmlWriterMock(new StreamAdapter(ms));
            byte[] arr = new byte[] {1, 2, 3, 5, 6, 7, 8, 9, 0};
            writer.Write(arr);
            ms.Position = 0;
            string actual = Encoding.UTF8.GetString(ms.ToArray());
            string expected = "<array>1,2,3,5,6,7,8,9,0</array>";
            Assert.AreEqual(actual, expected);

            // deserialize serialized data
            XmlReaderMock reader = new XmlReaderMock(new StreamAdapter(ms));
            byte[] res = reader.ReadBytes(arr.Length);
            MyAssert.AreEqual(arr, res);
        }
        public void ReadWriteComplexTest()
        {
            MemoryStream ms = new MemoryStream();
            // serialize some data
            XmlWriterMock writer = new XmlWriterMock(new StreamAdapter(ms));
            DateTime dat = new DateTime(2002, 2, 2, 2, 2, 2); // 02.02.2002 02:02:02
            writer.Write(dat);
            string str = "test string";
            writer.Write(str);
            int integer = 223344;
            writer.Write(integer);
            float single = 1.2345f;
            writer.Write(single);
            byte[] bytes = new byte[] {5,4,3,2,1};
            writer.Write(bytes);
            long int64 = 1234567890;
            writer.Write(int64);

            ms.Position = 0;

            // deserialize serialized data
            XmlReaderMock reader = new XmlReaderMock(new StreamAdapter(ms));
            DateTime adat = reader.ReadDateTime();
            Assert.AreEqual(dat, adat);
            string astr = reader.ReadString();
            Assert.AreEqual(str, astr);
            int aint = reader.ReadInt32();
            Assert.AreEqual(integer, aint);
            float asingle = reader.ReadSingle();
            Assert.AreEqual(single, asingle);
            byte[] abytes = reader.ReadBytes(bytes.Length);
            MyAssert.AreEqual(bytes, abytes);
            long aint64 = reader.ReadInt64();
            Assert.AreEqual(int64, aint64);
        }