Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 67 lines (54 sloc) 1.929 kb
0bbea35 Simon Bailey Project and tests plus updated README
authored
1 package com.newtriks.restricted.shell.restricted.controller
2 {
3 import asunit.asserts.*;
4 import asunit.framework.IAsync;
5
6 import com.newtriks.restricted.shell.api.views.components.AS3ModularRobotLegsExampleView;
7 import com.newtriks.restricted.shell.restricted.models.IModuleStore;
8
9 import flash.display.Sprite;
10 import flash.events.Event;
11 import flash.events.EventDispatcher;
12 import flash.events.IEventDispatcher;
13
14 import mockolate.nice;
15 import mockolate.prepare;
16 import mockolate.verify;
17
18 import org.hamcrest.object.equalTo;
19
20 public class LoadModulesCommandTest
21 {
22 [Inject]
23 public var async:IAsync;
24
25 private var instance:LoadModulesCommand;
26 private var MODULE:Object={ module: Sprite };
27
28 [Before]
29 public function prepareMockolates():void
30 {
31 var mockolateMaker:IEventDispatcher=prepare(IModuleStore);
32 async.proceedOnEvent(mockolateMaker, Event.COMPLETE, 5000);
33 }
34
35 [Before]
36 public function setUp():void
37 {
38 instance=new LoadModulesCommand();
39 instance.eventDispatcher=new EventDispatcher();
40 instance.contextView=new AS3ModularRobotLegsExampleView();
41 instance.moduleStore=nice(IModuleStore);
42 instance.modules=[MODULE];
43 }
44
45 [After]
46 public function tearDown():void
47 {
48 instance=null;
49 }
50
51 [Test]
52 public function should_be_instantiated():void
53 {
54 assertTrue(instance is LoadModulesCommand);
55 }
56
57 [Test]
58 public function should_create_and_add_modules_to_store():void
59 {
60 instance.execute();
61 verify(instance.moduleStore).method("addModule").args(equalTo(MODULE),
62 equalTo(instance.moduleContainer));
63 }
64 }
65 }
66
Something went wrong with that request. Please try again.