DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Classes | Static Public Member Functions | List of all members
Deveel.Data.Serialization.BinarySerializeTests Class Reference

Classes

class  TestClass
 
class  TestClass2
 

Static Public Member Functions

static void SerializeWithNoParent ()
 
static void SerializeObjectNameWithNoParent ()
 
static void SerializeImplicit ()
 

Detailed Description

Definition at line 24 of file BinarySerializeTests.cs.

Member Function Documentation

static void Deveel.Data.Serialization.BinarySerializeTests.SerializeImplicit ( )
inlinestatic

Definition at line 78 of file BinarySerializeTests.cs.

78  {
79  var obj = new TestClass2("test2");
80 
81  var serializer = new BinarySerializer();
82  byte[] bytes;
83 
84  using (var memoryStream = new MemoryStream()) {
85  serializer.Serialize(memoryStream, obj);
86  memoryStream.Flush();
87  bytes = memoryStream.ToArray();
88  }
89 
90  object graph = null;
91  using (var memoryStream = new MemoryStream(bytes)) {
92  graph = serializer.Deserialize(memoryStream, typeof(TestClass2));
93  }
94 
95  Assert.IsNotNull(graph);
96  Assert.IsInstanceOf<TestClass2>(obj);
97 
98  obj = (TestClass2) graph;
99  Assert.AreEqual("test2", obj.Value);
100  Assert.IsNull(obj.Parent);
101 
102  }
static void Deveel.Data.Serialization.BinarySerializeTests.SerializeObjectNameWithNoParent ( )
inlinestatic

Definition at line 52 of file BinarySerializeTests.cs.

52  {
53  var objName = new ObjectName("name");
54 
55  var serializer = new BinarySerializer();
56  byte[] bytes;
57 
58  using (var memoryStream = new MemoryStream()) {
59  serializer.Serialize(memoryStream, objName);
60  memoryStream.Flush();
61  bytes = memoryStream.ToArray();
62  }
63 
64  object graph = null;
65  using (var memoryStream = new MemoryStream(bytes)) {
66  graph = serializer.Deserialize(memoryStream, typeof(ObjectName));
67  }
68 
69  Assert.IsNotNull(graph);
70  Assert.IsInstanceOf<ObjectName>(graph);
71 
72  var objName2 = (ObjectName) graph;
73  Assert.AreEqual(objName.Name, objName2.Name);
74  Assert.AreEqual(objName, objName2);
75  }
Describes the name of an object within a database.
Definition: ObjectName.cs:44
static void Deveel.Data.Serialization.BinarySerializeTests.SerializeWithNoParent ( )
inlinestatic

Definition at line 26 of file BinarySerializeTests.cs.

26  {
27  var obj = new TestClass {Value = "test1"};
28 
29  var serializer = new BinarySerializer();
30  byte[] bytes;
31 
32  using (var memoryStream = new MemoryStream()) {
33  serializer.Serialize(memoryStream, obj);
34  memoryStream.Flush();
35  bytes = memoryStream.ToArray();
36  }
37 
38  object graph = null;
39  using (var memoryStream = new MemoryStream(bytes)) {
40  graph = serializer.Deserialize(memoryStream, typeof(TestClass));
41  }
42 
43  Assert.IsNotNull(graph);
44  Assert.IsInstanceOf<TestClass>(obj);
45 
46  obj = (TestClass) graph;
47  Assert.AreEqual("test1", obj.Value);
48  Assert.IsNull(obj.Parent);
49  }

The documentation for this class was generated from the following file: