Esempio n. 1
0
        public void TestStruct2()
        {
            Serializer serpent = new Serializer(true, namespaceInClassName: true);

            var obj2 = new SerializeTestStruct
            {
                i = 99,
                s = "hi",
                x = 42
            };
            var ser = strip_header(serpent.Serialize(obj2));

            Assert.Equal("{\n  '__class__': 'Razorvine.Serpent.Test.SerializeTestStruct',\n  'i': 99,\n  's': 'hi'\n}", S(ser));
        }
Esempio n. 2
0
        public void TestStruct()
        {
            Serializer serpent = new Serializer(true);

            var obj2 = new SerializeTestStruct
            {
                i = 99,
                s = "hi",
                x = 42
            };
            var ser = strip_header(serpent.Serialize(obj2));

            Assert.Equal("{\n  '__class__': 'SerializeTestStruct',\n  'i': 99,\n  's': 'hi'\n}", S(ser));
        }
Esempio n. 3
0
        public void TestStruct2()
        {
            Serializer           serpent = new Serializer(indent: true, namespaceInClassName: true);
            UnserializableStruct obj;

            Assert.Throws <SerializationException>(() => serpent.Serialize(obj));

            var obj2 = new SerializeTestStruct()
            {
                i = 99,
                s = "hi",
                x = 42
            };

            byte[] ser = strip_header(serpent.Serialize(obj2));
            Assert.AreEqual("{\n  '__class__': 'Razorvine.Serpent.Test.SerializeTestStruct',\n  'i': 99,\n  's': 'hi'\n}", S(ser));
        }
Esempio n. 4
0
 public bool Equals(SerializeTestStruct other)
 {
     return(x == other.x && string.Equals(s, other.s) && i == other.i);
 }
Esempio n. 5
0
        public void TestStruct2()
        {
            Serializer serpent = new Serializer(indent: true, namespaceInClassName: true);
            UnserializableStruct obj;
            Assert.Throws<SerializationException>( ()=>serpent.Serialize(obj) );

            var obj2 = new SerializeTestStruct() {
                i = 99,
                s = "hi",
                x = 42
            };
            byte[] ser = strip_header(serpent.Serialize(obj2));
            Assert.AreEqual("{\n  '__class__': 'Razorvine.Serpent.Test.SerializeTestStruct',\n  'i': 99,\n  's': 'hi'\n}", S(ser));
        }