Skip to main content
nikos101
Inspiring
Jan 5, 2011 12:50 PM UTC
Question

Testing a service that returns an AsyncToken

I have a working test that tests a service that returns an AsyncToken. I am using AsyncResponder instead of any of the Aysnc Flexunit stuff. Is this OK?

One thing I don't get is that the passthroughData get passed to the onResult method, even though AsyncResponder doesn't pass on anything other than the event.

    [Test(async)]

        public function testAttemptLogin():void

        {

      var token: AsyncToken = objectToTest.attemptLogin('k');

     token.addResponder(new AsyncResponder(onResult, faultHandler));

        }

        private function onResult(event:ResultEvent,passthroughData:Object):void {

//assertions

            }

This topic is closed to new replies. Start a new post to keep the conversation going.

2 replies

Participating Frequently
Jan 5, 2011 4:15 PM UTC

No. This will not work.

FlexUnit has a Async.asyncResponder

method that will do what you want

Mike

Translate
nikos101
nikos101Author
Inspiring
Jan 5, 2011 4:18 PM UTC

works for me, and brings the data back

Translate