public void ShouldNotSerializeFieldsWithAtCharacter()
        {
            string recordString = "TestClass@foo:true";

            ODocument document = new ODocument()
                                 .SetField("@OClassName", "TestClass")
                                 .SetField("@ClassId", 123)
                                 .SetField("@Foo", "bar")
                                 .SetField("@ORID", new ORID(8, 0))
                                 .SetField <bool>("foo", true);

            string serializedRecord = Encoding.UTF8.GetString(serializer.Serialize(document));

            Assert.Equal(serializedRecord, recordString);
        }
        //[Fact]
        public void ShouldSerializeDocumnet()
        {
            //string serString = "ABJUZXN0Q2xhc3MpAAAAEQDI/wE=";
            ODocument document = new ODocument();

            document.OClassName = "TestClass";
            document.SetField <DateTime>("eeee", new DateTime(635487552000000000));

            var str = Convert.ToBase64String(serializer.Serialize(document));
        }
Example #3
0
        public void TestSerializeArray()
        {
            string recordString = "TestArray@values:[1,2,3,4,5]";

            var       rawRecord = Encoding.UTF8.GetBytes(recordString);
            ODocument document  = serializer.Deserialize(rawRecord, new ODocument());

            TypeMapper <TestArray> tm = TypeMapper <TestArray> .Instance;
            var t = new TestArray();

            tm.ToObject(document, t);

            Assert.NotNull(t.values);
            Assert.Equal(5, t.values.Length);
            Assert.Equal(3, t.values[2]);

            ODocument newODocument = ODocument.ToDocument(t);
            var       serialized   = Encoding.UTF8.GetString(serializer.Serialize(newODocument));

            Assert.Equal(recordString, serialized);
        }
Example #4
0
 public string Serialize(WalEntry <T> record)
 {
     return(record.Action + Delimiter + record.HashCode + Delimiter
            + (record.Record != null ? _serializer.Serialize(record.Record) : ""));
 }