public void TestMethod2()
        {
            ResetTestState();
            Console.WriteLine(MethodBase.GetCurrentMethod().Name);

            var v1 = new CTestClass1();

            v1.Init1();

            Console.WriteLine("Key1:");
            IKey key = IKeyFactory.CreateKey("RootKey");

            _serializer.Serialize(v1, key, this);
            string text = key.SaveToString();

            Console.WriteLine(text);

            int mem_sz = key.GetMemorySize();

            byte[] array = new byte[mem_sz];

            key.BinarySerialize(array, 0);
            Console.WriteLine($"Array Size: {array.Length} bytes");

            Console.WriteLine("Key2:");
            IKey key2 = IKeyFactory.CreateKey(array, 0);

            text = key2.SaveToString();
            Console.WriteLine(text);

            var v2 = _serializer.Deserialize <CTestClass1>(key2, this);

            CheckInternalErrors();
            Assert.AreEqual(v1, v2);
        }
Exemple #2
0
        public void TestMethod_DefaultValue_SimpleInherite_Convert_Ignore_Default()
        {
            ResetTestState();
            Console.WriteLine(MethodBase.GetCurrentMethod().Name);
            var v1 = new CTestClass1();

            string text = _serializer.SerializeToCascade(v1, this);

            Console.WriteLine(text);
            var v2 = _serializer.Deserialize <CTestClass1>(text, this);

            CheckInternalErrors();
            Assert.AreEqual(v1, v2);
        }