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)); }
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)); }
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)); }