https://github.com/joelhooks/utilities-asyncservicestubs
Various Asynchronous Stub Classes that I have found to be useful for testing.
https://github.com/joelhooks/utilities-asyncservicestubs
Last synced: 3 months ago
JSON representation
Various Asynchronous Stub Classes that I have found to be useful for testing.
- Host: GitHub
- URL: https://github.com/joelhooks/utilities-asyncservicestubs
- Owner: joelhooks
- Created: 2009-10-23T20:34:20.000Z (over 15 years ago)
- Default Branch: master
- Last Pushed: 2009-10-25T15:46:22.000Z (over 15 years ago)
- Last Synced: 2025-04-04T11:07:46.883Z (3 months ago)
- Language: ActionScript
- Homepage:
- Size: 449 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.textile
Awesome Lists containing this project
README
A couple of AsyncStub classes "found here":http://www.brianlegros.com/blog/2009/02/21/using-stubs-for-httpservice-and-remoteobject-in-flex/
public class ClassWithHTTPServiceDependencyTest extends TestCase
{
private var _classBeingTested : ClassWithHTTPServiceDependency;
private var _stub : HTTPServiceStub;
override protected function setUp() : void
{
_classBeingTested = new ClassWithHTTPServiceDependency();
_stub = new HTTPServiceStub("http://thisisntarealdomain.com");
_stub.delay = 500;
_classBeingTested.service = _stub;
}
public function testSendWithTokenResult() : void
{
var result : Function = function (event : DynamicEvent, passThroughData : Object) : void
{
assertEquals("GOAL!", event.payload);
};
_stub.result(null, "GOAL!");
_classBeingTested.addEventListener("success", asyncHandler(result, 2000));
_classBeingTested.someMethodUsingHTTPService();
}
}