0 Replies Latest reply on Aug 6, 2010 6:49 AM by nikos101

    Best way to test this remote method generated by FB4

    nikos101 Level 2

      What the best way to test this remote method generated by FB4

       

          public function getBranches() : mx.rpc.AsyncToken
          {
              var _internal_operation:mx.rpc.AbstractOperation = _serviceControl.getOperation("getBranches");
              var _internal_token:mx.rpc.AsyncToken = _internal_operation.send() ;

       

              return _internal_token;
          }

       

      I was thinking something like this but I'm not sure:

       


              [Test(async,timeout="500")]
              public function testGetBranches():void
              {
                  var classToTestRef:retail= new Retail();
                  var EVENT_TYPE:String =  //result event?;
                 
                  classToTestRef.addEventListener(EVENT_TYPE, Async.asyncHandler( this,  handleAsyncEvnet, 500 ), false, 0, true );
                  classToTestRef.testMthod("test");
              }
             
             
             
         
             
              private function handleAsyncEvnet(event:Event, passThroughData:Object):void
              {
                  Assert.assertEquals( event.type, //result event? );
              }