public void Ctor () { ActionPoker a = new ActionPoker(); ScriptEvent e = new ScriptEvent (a, "HelloEvent", true); Assert.AreEqual ("HelloEvent", e.Name, "A1"); Assert.IsTrue (e.SupportsActions, "A2"); }
public void Properties () { ActionPoker a = new ActionPoker (); ScriptEvent e = new ScriptEvent (a, "HelloEvent", true); // defaults not specified in the ctor Assert.AreEqual ("", e.Handler, "A1"); // getter/setter e.Handler = "foo"; Assert.AreEqual ("foo", e.Handler, "A2"); // setting to null e.Handler = null; Assert.AreEqual ("", e.Handler, "A5"); }
void DoPropertyChanged (IScriptObject owner, ScriptEvent PropertyChanged) { Assert.AreEqual ("propertyChanged", PropertyChanged.Name, "p1"); Assert.AreEqual (true, PropertyChanged.SupportsActions, "p2"); Assert.AreEqual ("", PropertyChanged.Handler, "p3"); Assert.IsNotNull (PropertyChanged.Actions, "p4"); DoActions (owner, PropertyChanged.Actions); }
public void No_SupportsActions () { ActionPoker a = new ActionPoker (); ScriptEvent e = new ScriptEvent (a, "HelloEvent", false); Assert.IsNotNull (e.Actions, "A1"); e.Actions.Add (new ActionPoker ()); }
public void Null_Ctor2 () { ActionPoker a = new ActionPoker(); ScriptEvent e = new ScriptEvent (a, null, true); }
public void Null_Ctor1 () { ScriptEvent e = new ScriptEvent (null, "HelloEvent", true); }
public void RenderHandlers () { ActionPoker a = new ActionPoker (); ScriptEvent e = new ScriptEvent (a, "HelloEvent", true); StringWriter sw; ScriptTextWriter w; sw = new StringWriter(); w = new ScriptTextWriter (sw); e.Handler = "hi there"; e.RenderHandlers (w); Assert.AreEqual ("HelloEvent=\"hi there\"", sw.ToString(), "A1"); }
public void RenderActions () { ActionPoker a = new ActionPoker (); ScriptEvent e = new ScriptEvent (a, "HelloEvent", true); StringWriter sw; ScriptTextWriter w; // test an empty event sw = new StringWriter(); w = new ScriptTextWriter (sw); e.RenderActions (w); Assert.AreEqual ("", sw.ToString(), "A1"); // now add an action and see what happens ActionPoker action = new ActionPoker (); action.ID = "action_id"; action.Target = "action_target"; e.Actions.Add (action); e.RenderActions (w); Assert.AreEqual ("<HelloEvent>\n <poker id=\"action_id\" target=\"action_target\" />\n</HelloEvent>", sw.ToString().Replace ("\r\n", "\n"), "A2"); }
public void SupportsActions () { ActionPoker a = new ActionPoker (); ScriptEvent e = new ScriptEvent (a, "HelloEvent", true); Assert.IsNotNull (e.Actions, "A1"); e.Actions.Add (new ActionPoker ()); Assert.AreEqual (1, e.Actions.Count, "A2"); }