Skip to content

Instantly share code, notes, and snippets.

View joelhooks's full-sized avatar
🍄

Joel Hooks joelhooks

🍄
View GitHub Profile
@joelhooks
joelhooks / ISQLRunnerDelegate.as
Created July 6, 2011 02:36
Delegating at the Boundaries to Create a Testable Service
import com.probertson.data.QueuedStatement;
public interface ISQLRunnerDelegate
{
function get numConnections():int;
function get connectionErrorHandler():Function;
function set connectionErrorHandler(value:Function):void;
[Test]
public function toParamObject_returnsGenericObjectWithCorrectPropertyValues_objectIsEqual():void
{
var paramObject:Object;
var task:Task = new Task("testTask");
task.description = "task description";
task.statusId = 1;
task.taskId = 1;
paramObject = task.toParamObject();
[Test]
public function command_dispatches_completed_when_all_sync_commands_complete():void
{
var command:CompositeSignalCommand = getCompositeSignalCommandWithThreeSubCommands();
var completedSignal:VerifyDispatchSignal = new VerifyDispatchSignal();
command.completed = completedSignal;
command.execute();
assertThat(completedSignal.dispatched, isTrue());
[Test]
public function command_dispatches_completed_when_all_sync_commands_complete():void
{
var command:CompositeSignalCommand = getCompositeSignalCommandWithThreeSubCommands();
var completedSignal:Signal = strict(Signal);
mock(completedSignal).method("dispatch").once();
stub(completedSignal).method("removeAll");
command.completed = completedSignal;
command.execute();
<?xml version="1.0"?>
<!-- Parsley Configuration -->
<mx:Object xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:chain="http://spicefactory.org/parsley/chain">
<mx:Script><![CDATA[
import events.*
import commands.*;
]]>
</mx:Script>
//in draw() - the label bits were throwing an error with
//standard value objects with a toString complaining that
//there was no label property before it hit the else.
//I thought the string test was repetitive, since the
//_data.toString() covers that too, but the property check
//is what let me compile my app.
if(_data.hasOwnProperty("label") && _data["label"] is String)
{
_label.text = _data.label;
}
import flash.display.DisplayObjectContainer;
import flash.system.ApplicationDomain;
import org.robotlegs.base.SignalCommandMap;
import org.robotlegs.core.IInjector;
import org.robotlegs.core.ISignalCommandMap;
import org.robotlegs.core.ISignalContext;
import org.robotlegs.utilities.modular.mvcs.ModuleContext;