예제 #1
0
        public void SerializeDeserializeToFromBytes()
        {
            var testObject = new SerializeXmlTestObject
            {
                Name  = "testName",
                CanDo = true
            };

            var enc             = new Encoder();
            var sxu             = new GenLib.Helper.SerializeXml();
            var serializedBytes = enc.StringToBytes(sxu.Serialize <SerializeXmlTestObject>(testObject));

            var result = enc.ConvertToHex(enc.BytesToString(serializedBytes), true);

            Console.WriteLine(result);

            var newTestObject = sxu.Deserialize <SerializeXmlTestObject>(enc.BytesToString(serializedBytes));

            Assert.Equal(testObject.Name, newTestObject.Name);

            Assert.True(true);
        }