1

我将 RemoteObject 包装在一个类中,以便更轻松地管理重试、超时、失败和此类非标准场景。因此,当将 RemoteObject 包装在另一个类中时,我将如何进行单元测试呢?

以下是如何使用该类的示例:

// 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");
       });

例如,您知道 Adob​​e 如何测试 RemoteObject 类吗?由于我没有在服务器端使用特定的数据对象(我的包装器是通用的,旨在替换 RemoteObject 的任何使用),我不认为 Mocking 是答案。或者是吗?

我应该建立一个 Amf 服务来测试一些东西吗?或者是否有任何模拟 Amf 服务可以反映您拨打的任何电话?

4

0 回答 0