Esempio n. 1
0
        public override System.Object Clone()
        {
            PayloadAttributeImpl impl = new PayloadAttributeImpl();

            impl.payload = new Payload(this.payload.data, this.payload.offset, this.payload.length);
            return(impl);
        }
		public virtual void  TestPayloadAttribute()
		{
			PayloadAttributeImpl att = new PayloadAttributeImpl();
			Assert.IsNull(att.GetPayload());
			
			Payload pl = new Payload(new byte[]{1, 2, 3, 4});
			att.SetPayload(pl);
			
			PayloadAttributeImpl att2 = (PayloadAttributeImpl) AssertCloneIsEqual(att);
			Assert.AreEqual(pl, att2.GetPayload());
			Assert.AreNotSame(pl, att2.GetPayload());
			
			att2 = (PayloadAttributeImpl) AssertCopyIsEqual(att);
			Assert.AreEqual(pl, att2.GetPayload());
            Assert.AreNotSame(pl, att2.GetPayload());
			
			att.Clear();
			Assert.IsNull(att.GetPayload());
		}
Esempio n. 3
0
        public override bool Equals(System.Object other)
        {
            if (other == this)
            {
                return(true);
            }

            if (other is PayloadAttribute)
            {
                PayloadAttributeImpl o = (PayloadAttributeImpl)other;
                if (o.payload == null || payload == null)
                {
                    return(o.payload == null && payload == null);
                }

                return(o.payload.Equals(payload));
            }

            return(false);
        }
		public virtual void  TestPayloadAttribute()
		{
			PayloadAttributeImpl att = new PayloadAttributeImpl();
			Assert.IsNull(att.GetPayload());
			
			Payload pl = new Payload(new byte[]{1, 2, 3, 4});
			att.SetPayload(pl);
			
			PayloadAttributeImpl att2 = (PayloadAttributeImpl) AssertCloneIsEqual(att);
			Assert.AreEqual(pl, att2.GetPayload());
			Assert.AreNotSame(pl, att2.GetPayload());
			
			att2 = (PayloadAttributeImpl) AssertCopyIsEqual(att);
			Assert.AreEqual(pl, att2.GetPayload());
            Assert.AreNotSame(pl, att2.GetPayload());
			
			att.Clear();
			Assert.IsNull(att.GetPayload());
		}
Esempio n. 5
0
		public override System.Object Clone()
		{
            PayloadAttributeImpl impl = new PayloadAttributeImpl();
            impl.payload = new Payload(this.payload.data, this.payload.offset, this.payload.length);
            return impl;
		}