Merge branch 'master' into history
[potlatch2.git] / tests / src / net / systemeD / halcyon / connection / actions / SetTagActionTest.as
1 package net.systemeD.halcyon.connection.actions {
2
3     import org.flexunit.Assert;
4     import net.systemeD.halcyon.connection.actions.SetTagAction;
5     import net.systemeD.halcyon.connection.UndoableAction;
6     import net.systemeD.halcyon.connection.Entity;
7     import net.systemeD.halcyon.connection.Connection;
8
9     [RunWith("org.mockito.integrations.flexunit4.MockitoClassRunner")]
10     public class SetTagActionTest {
11
12         [Mock(type="net.systemeD.halcyon.connection.Connection", argsList="constructorArgs")]
13         public var connection:Connection;
14         public var constructorArgs:Array = ["name", "api", "policy"];
15
16         [Before]
17         public function setUp():void {
18             //Instantiate the connection first to prevent errors
19             //Connection.getConnection();
20         }
21
22         [Test]
23         public function setTag():void {
24             var e:Entity = new Entity(connection,1,1,{},true,1,"");
25             var action:UndoableAction = new SetTagAction(e, "foo", "bar");
26             action.doAction();
27
28             Assert.assertEquals("bar", e.getTag("foo"));
29         }
30
31         [Test]
32         public function setNullTag():void {
33             var e:Entity = new Entity(connection,1,1,{foo: "bar"},true,1,"");
34             var action:UndoableAction = new SetTagAction(e, "foo", null);
35             action.doAction();
36
37             Assert.assertNull(e.getTag("foo"));
38         }
39
40     }
41 }