Created
May 28, 2010 15:32
-
-
Save Stray/417294 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package app.restricted.controller.commands { | |
import asunit.framework.TestCase; | |
import org.robotlegs.mvcs.Command; | |
import flash.events.Event; | |
import flash.events.IEventDispatcher; | |
import mockolate.prepare; | |
import mockolate.nice; | |
import mockolate.stub; | |
import mockolate.verify; | |
import org.hamcrest.core.anything; | |
import org.hamcrest.core.not; | |
import org.hamcrest.object.equalTo; | |
import org.hamcrest.object.nullValue; | |
import org.hamcrest.object.strictlyEqualTo; | |
import app.restricted.services.ISearchService; | |
public class ClearSearchCommandTest extends TestCase { | |
private var instance:ClearSearchCommand; | |
public function ClearSearchCommandTest(methodName:String=null) { | |
super(methodName) | |
} | |
override public function run():void{ | |
var mockolateMaker:IEventDispatcher = prepare(ISearchService); | |
mockolateMaker.addEventListener(Event.COMPLETE, prepareCompleteHandler); | |
} | |
private function prepareCompleteHandler(e:Event):void{ | |
super.run(); | |
} | |
override protected function setUp():void { | |
super.setUp(); | |
instance = new ClearSearchCommand(); | |
instance.searchService = nice(ISearchService); | |
} | |
override protected function tearDown():void { | |
super.tearDown(); | |
instance = null; | |
} | |
public function testInstantiated():void { | |
assertTrue("instance is ClearSearchCommand", instance is ClearSearchCommand); | |
} | |
public function testIsCommand():void{ | |
assertTrue("instance is robotlegs Command", instance is Command); | |
} | |
public function testFailure():void { | |
assertTrue("Failing test", true); | |
} | |
public function testExecute():void { | |
assertTrue("Execute returns void", (instance.execute() == void)); | |
} | |
public function testExecuteCallsGetAllOnService():void{ | |
instance.execute(); | |
verify(instance.searchService).method('getAll').noArgs(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment