public void TestSerializationByValueNullReference() { byte[] buffer = Protocol.Serialize((ConcreteChildByValue)null); ConcreteChildByValue concreteObj2 = (ConcreteChildByValue)Protocol.Deserialize(buffer); Assert.That(concreteObj2, Is.Null); }
public void TestSerializationByValueBaseType() { ConcreteChildByValue concreteObj = new ConcreteChildByValue(12345678, 87654321); byte[] buffer = Protocol.Serialize((AbstractBaseByValue)concreteObj); ConcreteChildByValue concreteObj2 = (ConcreteChildByValue)Protocol.Deserialize(buffer); Assert.That(concreteObj.a, Is.EqualTo(concreteObj2.a)); Assert.That(concreteObj.b, Is.EqualTo(concreteObj2.b)); }
public static object Deserialize(StreamBuffer inBuffer, short length) { ConcreteChildByValue nullMember1 = (ConcreteChildByValue)DeserializeObject(inBuffer); ConcreteChildById nullMember2 = (ConcreteChildById)DeserializeObject(inBuffer); int nonNullMember3; int offset; byte[] buf = inBuffer.GetBufferAndAdvance(sizeof(int), out offset); Protocol.Deserialize(out nonNullMember3, buf, ref offset); return(new NullMembers(nullMember1, nullMember2, nonNullMember3)); }
public static short Serialize(StreamBuffer outBuffer, object obj) { ConcreteChildByValue obj2 = (ConcreteChildByValue)obj; int offset = 0; Protocol.Serialize(obj2.a, serializationBuffer, ref offset); Protocol.Serialize(obj2.b, serializationBuffer, ref offset); Assert.AreEqual(offset, serializationBuffer.Length); outBuffer.Write(serializationBuffer, 0, offset); return((short)offset); }
public NullMembers(ConcreteChildByValue nullMember1, ConcreteChildById nullMember2, int nonNullMember3) { this.nullMember1 = nullMember1; this.nullMember2 = nullMember2; this.nonNullMember3 = nonNullMember3; }