Exemplo n.º 1
0
 protected bool Equals(KitchenSinkPortable other)
 {
     return(Bool == other.Bool && BoolArray.SequenceEqual(other.BoolArray) &&
            ByteArray.SequenceEqual(other.ByteArray) && Byte == other.Byte &&
            CharArray.SequenceEqual(other.CharArray) && Char == other.Char &&
            ShortArray.SequenceEqual(other.ShortArray) &&
            Short == other.Short && IntArray.SequenceEqual(other.IntArray) && Int == other.Int &&
            LongArray.SequenceEqual(other.LongArray) && Long == other.Long &&
            FloatArray.SequenceEqual(other.FloatArray) &&
            Float.Equals(other.Float) && DoubleArray.SequenceEqual(other.DoubleArray) &&
            Double.Equals(other.Double) &&
            string.Equals(String, other.String) && StringArray.SequenceEqual(other.StringArray)
            );
 }
        public virtual void TestInputOutputWithPortableReader(ByteOrder byteOrder)
        {
            var portable = KitchenSinkPortable.Generate();

            var config = new SerializationConfig();
            config.AddPortableFactoryClass(KitchenSinkPortableFactory.FactoryId, typeof (KitchenSinkPortableFactory));

            var ss = new SerializationServiceBuilder().SetConfig(config).
                SetUseNativeByteOrder(false).SetByteOrder(byteOrder).Build();

            var data = ss.ToData(portable);
            var reader = ss.CreatePortableReader(data);

            var actual = new KitchenSinkPortable();
            actual.ReadPortable(reader);

            Assert.AreEqual(portable, actual);

            ss.Destroy();
        }
Exemplo n.º 3
0
        public virtual void TestInputOutputWithPortableReader(ByteOrder byteOrder)
        {
            var portable = KitchenSinkPortable.Generate();

            var config = new SerializationConfig();

            config.AddPortableFactoryClass(KitchenSinkPortableFactory.FactoryId, typeof(KitchenSinkPortableFactory));

            var ss = new SerializationServiceBuilder().SetConfig(config).
                     SetUseNativeByteOrder(false).SetByteOrder(byteOrder).Build();

            var data   = ss.ToData(portable);
            var reader = ss.CreatePortableReader(data);

            var actual = new KitchenSinkPortable();

            actual.ReadPortable(reader);

            Assert.AreEqual(portable, actual);

            ss.Destroy();
        }
Exemplo n.º 4
0
        public virtual void TestDataInputOutputWithPortable(ByteOrder byteOrder)
        {
            var portable = KitchenSinkPortable.Generate();

            var config = new SerializationConfig();

            config.AddPortableFactoryClass(KitchenSinkPortableFactory.FactoryId, typeof(KitchenSinkPortableFactory));

            var ss = new SerializationServiceBuilder().SetConfig(config).
                     SetUseNativeByteOrder(false).SetByteOrder(byteOrder).Build();

            IObjectDataOutput output = ss.CreateObjectDataOutput(1024);

            output.WriteObject(portable);
            var data = output.ToByteArray();

            IObjectDataInput input = ss.CreateObjectDataInput(data);
            var readObject         = input.ReadObject <IPortable>();

            Assert.AreEqual(portable, readObject);

            ss.Destroy();
        }
 protected bool Equals(KitchenSinkPortable other)
 {
     return Bool == other.Bool && BoolArray.SequenceEqual(other.BoolArray) &&
            ByteArray.SequenceEqual(other.ByteArray) && Byte == other.Byte &&
            CharArray.SequenceEqual(other.CharArray) && Char == other.Char &&
            ShortArray.SequenceEqual(other.ShortArray) &&
            Short == other.Short && IntArray.SequenceEqual(other.IntArray) && Int == other.Int &&
            LongArray.SequenceEqual(other.LongArray) && Long == other.Long &&
            FloatArray.SequenceEqual(other.FloatArray) &&
            Float.Equals(other.Float) && DoubleArray.SequenceEqual(other.DoubleArray) &&
            Double.Equals(other.Double)
            && string.Equals(String, other.String) && StringArray.SequenceEqual(other.StringArray) &&
            Equals(Serializable, other.Serializable)
         ;
 }