Hi guys, I started looking at the EasyMock framework but haven't had the time yet to play around with this in Prana. I would be very interested in doing so. Maybe it is worth joining the Prana list so we can discuss this in detail.
https://lists.sourceforge.net/lists/listinfo/prana-user regards, Christophe 2007/10/17, Bjorn Schultheiss <[EMAIL PROTECTED]>: > > try add > flash.net.registerClassAlias( "attempt.TestInterface", TestInterface ); > prior to your cast attempt. > > > regards, > > Bjorn > > > On 17/10/2007, at 1:06 PM, aduston1976 wrote: > > lus I see a number of places on the web where the idea is mentioned, > e.g. http://www.herrodius.com/blog/?m=200704 . However I cannot find > any mock frameworks for AS3. > > This evening I spent some time trying to mock one up on my own (ok, > sorry for the pun!) but I ran into troubles. Is anyone interested in > thinking about this problem with me? > > Here is what I did during my 20 minutes of playing: > > Define an interface: > > public interface TestInterface > { > function setSomething(something : String) : void; > } > > Run the following code: > > public function flexmock() { > var i : TestInterface; > var c : Class = > flash.utils.getDefinitionByName("attempt.TestInterface") as Class; > var desc : XML = flash.utils.describeType(c); > var str : String = desc.toString(); > var a : Object = new Object(); > a["setSomething"] = function(something : String) : void { > trace(something); }; > // will fail on the following line, since a does not implement > TestInterface. > i = TestInterface(a); > i.setSomething("blah"); > } > > AS3 doesn't support duck typing like Ruby, and I believe there is no > way to get an object in memory that implements the TestInterface > interface that my other objects can use as a mock. > > Any thoughts about this? Am I doomed to use elbow grease or code > generation to create these things? > > BTW, this message is also posted on the ActionScript 3 FlexUnit > Library forum in Google Groups. Hopefully that isn't some kind of > forum faux pas. > > Thank you for any comments, > Adam > > > -- Christophe Herreman http://www.herrodius.com

