Exemple #1
0
        public void OutValueTypeTest()
        {
            var     obj   = new OutParams();
            CGPoint point = new CGPoint(3, 14);
            bool    res;

            res = bool_objc_msgSend_out_CGPoint(obj.Handle, new Selector("Test_CGPoint:").Handle, out point);
            Assert.That(res, "#res");
            Assert.That(point.X, Is.EqualTo((nfloat)3.1415f), "#x");
            Assert.That(point.Y, Is.EqualTo((nfloat)0), "#y");
        }
Exemple #2
0
        public void OutParamTest()
        {
            var     obj      = new OutParams();
            NSError error    = new NSError(new NSString("doomed"), 314);
            IntPtr  errorptr = error.Handle;

            void_objc_msgSend_out_NSError(obj.Handle, new Selector("Test_NSError:arg1:").Handle, out errorptr, 0);
            error = errorptr == IntPtr.Zero ? null : Runtime.GetNSObject <NSError> (errorptr);
            Assert.That(error, Is.Null, "#1");

            void_objc_msgSend_out_NSError(obj.Handle, new Selector("Test_NSError:arg1:").Handle, out errorptr, 1);
            error = Runtime.GetNSObject <NSError> (errorptr);
            Assert.That(error.Domain, Is.EqualTo("domain"), "#2 - domain");
            Assert.That(error.Code, Is.EqualTo((nint)1), "#3 - code");
        }