public void SerializeAndDeserializeClassWithPrivateProperties() { var x = new TestFieldsClass2("Hello", 12); var fields = global::SQLiteServer.Fields.Fields.SerializeObject(x); var y = global::SQLiteServer.Fields.Fields.DeserializeObject <TestFieldsClass2>(fields); Assert.AreEqual(default(string), y.A); Assert.AreEqual(default(int), y.B); }
public void AddFieldsManuallyToClassWithPrivateVariables() { var x = new TestFieldsClass2("Hello", 12); var fields = new global::SQLiteServer.Fields.Fields(); fields.Add(new Field("A", typeof(string), "Hello")); fields.Add(new Field("B", typeof(int), 12)); var y = global::SQLiteServer.Fields.Fields.DeserializeObject <TestFieldsClass2>(fields); // we cannot set private values... Assert.AreEqual(default(string), y.A); Assert.AreEqual(default(int), y.B); }