public void BoxULongFromCls() { int val = 11; omg.org.CORBA.TypeCode tc = new ULongTC(); Any anyContainer = new Any(val, tc); Assert.AreEqual(tc, anyContainer.Type, "wrong tc"); Assert.AreEqual((uint)val, anyContainer.Value, "wrong val"); Assert.AreEqual(((uint)val).GetType(), anyContainer.Value.GetType(), "wrong val"); Assert.AreEqual(val, anyContainer.ClsValue, "wrong val"); }
public void BoxULongFromClsOutsideRange() { int val = -11; omg.org.CORBA.TypeCode tc = new ULongTC(); Any anyContainer = new Any(val, tc); Assert.AreEqual(tc, anyContainer.Type, "wrong tc"); // do an unchecked cast, overflow no issue here Assert.AreEqual(unchecked ((uint)val), anyContainer.Value, "wrong val"); Assert.AreEqual(unchecked ((uint)val).GetType(), anyContainer.Value.GetType(), "wrong val"); Assert.AreEqual(val, anyContainer.ClsValue, "wrong val"); }
public void BoxULong() { uint val = 11; omg.org.CORBA.TypeCode tc = new ULongTC(); Any anyContainer = new Any(val, tc); Assert.AreEqual(tc, anyContainer.Type, "wrong tc"); Assert.AreEqual(val, anyContainer.Value, "wrong val"); Assert.AreEqual((int)val, anyContainer.ClsValue, "wrong val"); Assert.AreEqual(ReflectionHelper.Int32Type, anyContainer.ClsValue.GetType(), "wrong val type"); }