public void TestMethodBase() { ResetTestState(); Console.WriteLine(MethodBase.GetCurrentMethod().Name); var v1 = new CTestBase(); v1.Init1(); string text = _serializer.SerializeToCascade(v1, this); Console.WriteLine(text); var v2 = _serializer.Deserialize <CTestBase>(text, this); CheckInternalErrors(); Assert.AreEqual(v1, v2); }
public void TestMethodBaseIncorrectEnumName() { ResetTestState(); Console.WriteLine(MethodBase.GetCurrentMethod().Name); var v1 = new CTestBase(); v1.Init1(); string text = _serializer.SerializeToCascade(v1, this); text = text.Replace("TestEnumValue", "TIIIUU"); Console.WriteLine(text); var v2 = _serializer.Deserialize <CTestBase>(text, this); //CheckInternalErrors(); //Assert.AreEqual(v1, v2); }
public void TestMethod1() { ResetTestState(); Console.WriteLine(MethodBase.GetCurrentMethod().Name); CTestBase v1 = new CTestBase(); v1.Init1(); Console.WriteLine("Key1:"); IKey key = IKeyFactory.CreateKey("RootKey"); _serializer.Serialize(v1, key, this); string text = key.SaveToString(); //BaseInt: 7 //BaseNullable: 9 //BaseFloat: 101.909 //BaseString: str2 //BaseEnum: TestEnumValue3 Console.WriteLine(text); //string input = "sun"; //byte[] array = Encoding.UTF8.GetBytes(input); 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 <CTestBase>(key2, this); CheckInternalErrors(); Assert.AreEqual(v1, v2); }