views:

243

answers:

0

I'm wrapping RemoteObject inside a class for easier managing of retries, timeouts, failures and such non standard scenarios. So when wrapping a RemoteObject inside another class, how would I go about unit testing this?

Here is an example of how to use the class:

// set up the object as you would a RemoteObject, but without events:
var employeeRO: RemoteObjectWrapper = new RemoteObjectWrapper();
employeeRO.destination = "SalaryManager";
employeeRO.source = "SalaryService";
employeeRO.endpoint = "http://example.com/amf/"; 

// when calling the service is where you specify what to happen with results:
employeeRO
   .call("getSalaries")
   .register(
       function onResult(salaries: Array): void
       {
           salaries.dataProvider = salaries;
       },
       function onFailure(f: *): void 
       {
           Alert.show("Failed to fetch salaries");
       });

Any idea of how Adobe tests the RemoteObject class for example? Since I'm not working with specific data objects on the server side (my wrapper is general and designed to replace any use of RemoteObject), I don't think Mocking is the answer. Or is it?

Should I build an Amf service just to have something to test against? Or are there any mocking Amf services out there that just mirrors any calls you make?