Ejemplo n.º 1
0
        public void TestSimple()
        {
            var dataToSerialize = new SerializationTestClass {
                Number = 1, String = "123"
            };

            serializer = new DataSerializer();
            byte[] bytes = serializer.Serialize(dataToSerialize);
            Assert.IsTrue(bytes.Length > 0);
            Assert.AreEqual(dataToSerialize, serializer.Deserialize <SerializationTestClass>(bytes));
        }
Ejemplo n.º 2
0
 public bool Equals(SerializationTestClass other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(other.Number == Number && Equals(other.String, String) && Equals(other.InnerClass, InnerClass));
 }
Ejemplo n.º 3
0
        public void TestWithInnerClass()
        {
            var dataToSerialize = new SerializationTestClass
            {
                Number     = 1,
                String     = "123",
                InnerClass = new SerializationTestInnerClass {
                    Id = Guid.NewGuid()
                }
            };

            serializer = new DataSerializer();
            byte[] bytes = serializer.Serialize(dataToSerialize);
            Assert.AreEqual(dataToSerialize, serializer.Deserialize <SerializationTestClass>(bytes));
        }