20 using NUnit.Framework;
22 namespace Deveel.Data.Serialization {
27 var obj =
new TestClass {Value =
"test1"};
32 using (var memoryStream =
new MemoryStream()) {
33 serializer.Serialize(memoryStream, obj);
35 bytes = memoryStream.ToArray();
39 using (var memoryStream =
new MemoryStream(bytes)) {
40 graph = serializer.Deserialize(memoryStream, typeof(
TestClass));
43 Assert.IsNotNull(graph);
47 Assert.AreEqual(
"test1", obj.
Value);
58 using (var memoryStream =
new MemoryStream()) {
59 serializer.Serialize(memoryStream, objName);
61 bytes = memoryStream.ToArray();
65 using (var memoryStream =
new MemoryStream(bytes)) {
66 graph = serializer.Deserialize(memoryStream, typeof(
ObjectName));
69 Assert.IsNotNull(graph);
73 Assert.AreEqual(objName.Name, objName2.Name);
74 Assert.AreEqual(objName, objName2);
84 using (var memoryStream =
new MemoryStream()) {
85 serializer.Serialize(memoryStream, obj);
87 bytes = memoryStream.ToArray();
91 using (var memoryStream =
new MemoryStream(bytes)) {
92 graph = serializer.Deserialize(memoryStream, typeof(
TestClass2));
95 Assert.IsNotNull(graph);
99 Assert.AreEqual(
"test2", obj.
Value);
100 Assert.IsNull(obj.
Parent);
114 public string Value {
get; set; }
136 public string Value {
get;
private set; }
139 get {
return parent; }
TestClass(ObjectData graph)
void SetValue(string key, Type type, object value)
Describes the name of an object within a database.
static void SerializeWithNoParent()
static void SerializeImplicit()
void GetData(SerializeData graph)
static void SerializeObjectNameWithNoParent()
object GetValue(string key)
string GetString(string key)