Exemple #1
0
        public void TestSerializationByValueNullReference()
        {
            byte[] buffer = Protocol.Serialize((ConcreteChildByValue)null);
            ConcreteChildByValue concreteObj2 = (ConcreteChildByValue)Protocol.Deserialize(buffer);

            Assert.That(concreteObj2, Is.Null);
        }
Exemple #2
0
        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));
        }
Exemple #3
0
            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));
            }
Exemple #4
0
            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);
            }
Exemple #5
0
 public NullMembers(ConcreteChildByValue nullMember1, ConcreteChildById nullMember2, int nonNullMember3)
 {
     this.nullMember1    = nullMember1;
     this.nullMember2    = nullMember2;
     this.nonNullMember3 = nonNullMember3;
 }