public void TestMediumImport()
        {
            int offset = 0;
            BinarySerializer serializer = new BinarySerializer();
            serializer.SetSerializableTypes(new Type[] { typeof(string), typeof(Int16), typeof(UInt32), typeof(Int16), typeof(string) });
            Byte[] export = serializer.SerializeData(new object[] { "abcd", 100, 100000, 900, "defghi" });
            object[] import = serializer.DeserializeData(export,0,ref offset);

            Assert.AreEqual(new object[] { "abcd", (UInt16)100, (UInt32)100000, (UInt16)900, "defghi" }, import, "defghi");
            Assert.AreEqual(20, offset);
        }
        public void TestManyParse()
        {
            BinarySerializer serializer = new BinarySerializer();
            serializer.SetSerializableTypes(new Type[] { typeof(VarByte), typeof(UInt16) });
            object[] TestData= new object[]{ 5, 1, 2, 3, 4, 5 };

            Byte[] export = serializer.SerializeData(TestData);
            int offset=0;
            object[] import = serializer.DeserializeData(export, 0, ref offset);

            Assert.AreEqual(TestData, import);

            serializer.SetSerializableTypes(new Type[] { typeof(VarUInt32), typeof(string), typeof(Int16), typeof(VarUInt16), typeof(Byte) });
            TestData = new object[] { 5, "a", "b", "c", "d", "e", 10, 3, 1, 2, 3 };
            export = serializer.SerializeData(TestData);
            offset = 0;
            import = serializer.DeserializeData(export, 0, ref offset);

            Assert.AreEqual(TestData, import);
        }
        public void TestMediumExportSerialization()
        {
            BinarySerializer serializer = new BinarySerializer();

            serializer.SetSerializableTypes(new Type[] { typeof(UInt16), typeof(UInt32) });
            Byte[] output = serializer.SerializeData(new object[] { 1, 100000 });
            string CompareData = GetBinaryString(SumByteArrays(GetData(1, typeof(UInt16)), GetData(100000, typeof(UInt32))));
            Assert.AreEqual(GetBinaryString(output), CompareData);

            serializer.SetSerializableTypes(new Type[] { typeof(string) });
            output = serializer.SerializeData(new object[] { "abcd" });
            Assert.AreEqual(new byte[] { (byte)'a', (byte)'b', (byte)'c', (byte)'d', 0 }, output);

            serializer.SetSerializableTypes(new Type[] { typeof(string), typeof(Int16), typeof(UInt32), typeof(Int16), typeof(string) });
            output = serializer.SerializeData(new object[] { "abcd", 100, 100000, 900, "defghi" });
            CompareData = GetBinaryString(SumByteArrays(new byte[] { (byte)'a', (byte)'b', (byte)'c', (byte)'d', 0 }, GetData(100, typeof(Int16)), GetData(100000, typeof(Int32)), GetData(900, typeof(Int16)), new byte[] { (byte)'d', (byte)'e', (byte)'f', (byte)'g', (byte)'h', (byte)'i', 0 }));
            Assert.AreEqual(GetBinaryString(output), CompareData);
        }
        public void TestByteSerialize()
        {
            int offset = 0;
            BinarySerializer serializer = new BinarySerializer();
            serializer.SetSerializableTypes(new Type[] { typeof(Byte[]) });

            Byte[] input = new Byte[] { 1, 2, 3, 4, 5 };
            Byte[] export = serializer.SerializeData(new object[] { input });

            object[] import = serializer.DeserializeData(export, 0, ref offset);
            Assert.AreEqual(input, import[0]);
        }