<pre>
private var instanceCommand:CreateOrUpdateConstituentCommand;
protected static const CONSTITUENT:Constituent = new Constituent();
[Before(order=1)]
public function setUp():void
{
var mockolateMaker:IEventDispatcher = prepare(IConstituentModel);
mockolateMaker.addEventListener(Event.COMPLETE, prepareCompleteHandler);
}
[Before(order=2)]
public function run():void
{
instanceCommand = new CreateOrUpdateConstituentCommand();
instanceCommand.eventDispatcher = new EventDispatcher();
var constituent:Constituent = CONSTITUENT;
instanceCommand.event = new PetitionEvent ( PetitionEvent.PETITION_SUBMITED, false, false, constituent );
instanceCommand = nice(IConstituentModel);
}
protected function prepareCompleteHandler ( event : Event ) : void
{
IEventDispatcher(event.target).removeEventListener(Event.COMPLETE, prepareCompleteHandler);
}
</pre>
And the related test:
<pre>
[Test]
public function testExecute():void {
stub(instanceCommand.constituentModel).setter('constituent').arg(CONSTITUENT);
assertTrue("Execute returns void", (instanceCommand.execute() == void));
}
</pre>
FloxyMockolateFactory prepareClassRecipes [class IConstituentModel],
ProxyRepository.prepareClasses 1 [class IConstituentModel],
ProxyRepository.prepareClasses classToPrepare [class IConstituentModel]
ProxyRepository.prepareClasses namespacesToProxy
ProxyRepository.prepareClasses proxy mockolate.generated:IConstituentModel6B41B06A6C809987C67C4A48442E27E19F3C0220
[SWF] crypt:MyAppClient:bin-debug:FlexUnitApplication.swf:[[DYNAMIC]]:7 - 1,198 bytes after decompression
ProxyRepository.prepareClasses loaded item [class IConstituentModel],,mockolate.generated:IConstituentModel6B41B06A6C809987C67C4A48442E27E19F3C0220
ProxyRepository.prepareClasses loaded mockolate.generated::IConstituentModel6B41B06A6C809987C67C4A48442E27E19F3C0220
ProxyRepository.prepareClasses loaded [class IConstituentModel] [class IConstituentModel6B41B06A6C809987C67C4A48442E27E19F3C0220]
FloxyMockolateFactory prepareClassRecipes prepared [class IConstituentModel] [class IConstituentModel6B41B06A6C809987C67C4A48442E27E19F3C0220]
FloxyMockolateFactory prepareClassRecipes classRecipe [ClassRecipe classToPrepare=[class IConstituentModel] namespacesToProxy=null proxyClass=null]
FloxyMockolateFactory prepareClassRecipes complete [class IConstituentModel],,mockolate.generated:IConstituentModel6B41B06A6C809987C67C4A48442E27E19F3C0220
[Before]
public function setUp():void
{
var mockolateMaker:IEventDispatcher = prepare(IConstituentModel);
mockolateMaker.addEventListener(Event.COMPLETE, prepareCompleteHandler);
}
public function run():void
{
instanceCommand = new CreateOrUpdateConstituentCommand();
instanceCommand.eventDispatcher = new EventDispatcher();
var constituent:Constituent = CONSTITUENT;
instanceCommand.event = new PetitionEvent ( PetitionEvent.PETITION_SUBMITED, false, false, constituent );
instanceCommand.constituentModel = nice(IConstituentModel);
}
protected function prepareCompleteHandler ( event : Event ) : void
{
run();
IEventDispatcher(event.target).removeEventListener(Event.COMPLETE, prepareCompleteHandler);
}
[Rule]
public var rule:MockolateRule = new MockolateRule();
[Mock]
public var constituentModel:IConstituentModel;
private var instanceCommand:CreateOrUpdateConstituentCommand;
protected static const CONSTITUENT:Constituent = new Constituent();
[Before]
public function setUp():void
{
instanceCommand = new CreateOrUpdateConstituentCommand();
instanceCommand.eventDispatcher = new EventDispatcher();
instanceCommand.event = new PetitionEvent ( PetitionEvent.PETITION_SUBMITED, false, false, CONSTITUENT );
instanceCommand.constituentModel = constituentModel;
}
FloxyMockolateFactory prepareClassRecipes classRecipe [ClassRecipe classToPrepare=[class IConstituentModel] namespacesToProxy=null proxyClass=null]
FloxyMockolateFactory prepareClassRecipes complete [class IConstituentModel],,mockolate.generated:IConstituentModel6B41B06A6C809987C67C4A48442E27E19F3C0220
In that first line I saw the namespacesToProxy=null proxyClass=null] and considered if that was a hint, although I didn't have enough information to discern what that meant. Then, in the second line it indicated that my model had actually been prepared. Now I understand that it probably had been prepared, but it was late as a result of my setup.
Anyway, I'm really pleased with my entry into Mockolate, this project is the first that I've implemented it. I figured that it would be a challenge, but like RL, the curve is there but seems to be pretty quick to traverse. Thanks for this group, its resources like this that help get in and get going.
Doug