Exemple #1
0
        public void BoxOctet()
        {
            byte val = 11;

            omg.org.CORBA.TypeCode tc = new OctetTC();
            Any anyContainer          = new Any(val, tc);

            Assert.AreEqual(tc, anyContainer.Type, "wrong tc");
            Assert.AreEqual(val, anyContainer.Value, "wrong val");
            Assert.AreEqual(val, anyContainer.ClsValue, "wrong val");
        }
Exemple #2
0
        public void BoxSByteToOctet()
        {
            sbyte val = 11;

            omg.org.CORBA.TypeCode tc = new OctetTC();
            Any anyContainer          = new Any(val, tc);

            Assert.AreEqual(tc, anyContainer.Type, "wrong tc");
            Assert.AreEqual((byte)val, anyContainer.Value, "wrong val");
            Assert.AreEqual((byte)val, anyContainer.ClsValue, "wrong val");
            Assert.AreEqual(ReflectionHelper.ByteType,
                            anyContainer.ClsValue.GetType(), "wrong val type");
        }
Exemple #3
0
        public void BoxSByteToOctetOutsideRange()
        {
            sbyte val = -11;

            omg.org.CORBA.TypeCode tc = new OctetTC();
            Any anyContainer          = new Any(val, tc);

            Assert.AreEqual(tc, anyContainer.Type, "wrong tc");
            // do an unchecked cast, overflow no issue here
            Assert.AreEqual(unchecked ((byte)val), anyContainer.Value, "wrong val");
            Assert.AreEqual(unchecked ((byte)val), anyContainer.ClsValue, "wrong val");
            Assert.AreEqual(ReflectionHelper.ByteType,
                            anyContainer.ClsValue.GetType(), "wrong val type");
        }