drewbourne/mockolate — Issue #59: Ease interception of flash_proxy methods
Author: drewbourne
Created: 2012-02-22 22:38:27+00:00
State: open

For classes that extend Proxy Mockolate should intercept all the flash_proxy methods in order to allow use of `expect()`.

Currently users have to do this:

```AS3
mock(proxyObject).nsMethod(flash_proxy, "callProperty").args("actualMethodName", arg1, arg2).returns(result);
mock(proxyObject).nsMethod(flash_proxy, "getProperty").args("actualPropertyName", arg1, arg2).returns(result);
mock(proxyObject).nsMethod(flash_proxy, "setProperty").args("actualPropertyName", value);
mock(proxyObject).nsMethod(flash_proxy, "hasProperty").args("actualPropertyName").returns(true);
```

When they should be able to do this:

```AS3
expect(proxyObject.actualMethodName(arg1, arg2)).returns(result);
expect(proxyObject.actualPropertyName).returns(result);
expect(proxyObject.actualPropertyName = value).returns(result);
expect("actualPropertyName" in proxyObject).returns(true);
```

Support for property access should also be added.

```AS3
expect(proxyObject[0]).returns(indexValue);
expect(proxyObject["propertyName"]).returns(propertyvalue);
```

Support for property iteration should also be added.

```AS3
mock(proxyObject).asProxy().withItems([ 1, 2, 3 ]);
for each (var item:* in proxyObject) { ... }
```

```AS3
mock(proxyObject).asProxy().withProperties({ one: 1, two: 2, three: 3 });
for (var key:* in proxyObject) {
var value:* = proxyObject[key];
}
```