示例#1
0
        public void TestPointerIVar()
        {
            IVarTest02 varTest02 = new IVarTest02();

            TSObject instanceValue = new TSObject();
            varTest02.InstanceProperty = instanceValue;
            Assert.AreEqual(instanceValue, varTest02.InstanceProperty, "Instance property must be equals");
            Assert.AreEqual(instanceValue.NativePointer, varTest02.InstanceProperty.NativePointer, "Instance property must be equals");

            varTest02.Release();
        }
示例#2
0
        public void TestMultipleIVar()
        {
            IVarTest04 varTest04 = new IVarTest04();

            varTest04.BoolProperty = true;
            Assert.AreEqual(true, varTest04.BoolProperty, "Bool property must be equals");

            varTest04.BoolProperty = false;
            Assert.AreEqual(false, varTest04.BoolProperty, "Bool property must be equals");

            short shortValue = (short) new Random().Next(-42, 42);
            varTest04.ShortProperty = shortValue;
            Assert.AreEqual(shortValue, varTest04.ShortProperty, "Short property must be equals");

            int intValue = new Random().Next(-42, 42);
            varTest04.IntProperty = intValue;
            Assert.AreEqual(intValue, varTest04.IntProperty, "Int property must be equals");

            long longValue = new Random().Next(-42, 42);
            varTest04.LongProperty = longValue;
            Assert.AreEqual(longValue, varTest04.LongProperty, "Long property must be equals");

            TSObject instanceValue = new TSObject();
            varTest04.InstanceProperty = instanceValue;
            Assert.AreEqual(instanceValue, varTest04.InstanceProperty, "Instance property must be equals");
            Assert.AreEqual(instanceValue.NativePointer, varTest04.InstanceProperty.NativePointer, "Instance property must be equals");

            TSRect rectValue = new TSRect();
            rectValue.origin.x = (uint) new Random().Next(0, 1000);
            rectValue.origin.y = (uint) new Random().Next(2000, 3000);
            rectValue.size.width = (uint) new Random().Next(500, 1000);
            rectValue.size.height = (uint) new Random().Next(4000, 5000);
            varTest04.RectProperty = rectValue;
            Assert.AreEqual(rectValue, varTest04.RectProperty, "Rect property must be equals");
            Assert.AreEqual(rectValue.origin, varTest04.RectProperty.origin, "Rect property origin must be equals");
            Assert.AreEqual(rectValue.size, varTest04.RectProperty.size, "Rect property size must be equals");

            varTest04.Release();
        }