An open API service indexing awesome lists of open source software.

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.

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();
}
}