Пример #1
0
    public void ExceptionTest()
    {
        NSObject array = (NSObject) new Class("NSMutableArray").Call("alloc").Call("init");
        NSObject str   = (NSObject) new Class("NSString").Call("alloc").Call("init");

        array.Call("addObject:", str);

        NSObject result = (NSObject)array.Call("objectAtIndex:", 0U);

        Assert.IsTrue(!NSObject.IsNullOrNil(result));

        try
        {
            array.Call("objectAtIndex:", 1U);
        }
        catch (CocoaException e)
        {
            Assert.IsTrue(e.Message.Contains("Array"));
            Assert.IsTrue(e.Message.Contains("objectAtIndex"));
        }
    }