public void IsTypeDescriptorClosed() { ActionPoker a = new ActionPoker(); ScriptTypeDescriptor desc = ((IScriptObject)a).GetTypeDescriptor(); desc.AddEvent(new ScriptEventDescriptor("testEvent", true)); }
public void ScriptObject() { ActionPoker a = new ActionPoker(); ScriptTypeDescriptor td = new ScriptTypeDescriptor(a); Assert.AreEqual(a, td.ScriptObject, "A1"); }
public void Render() { ActionPoker a = new ActionPoker(); StringWriter sw; ScriptTextWriter w; // test an empty action sw = new StringWriter(); w = new ScriptTextWriterPoker(sw); a.Writer = sw; a.RenderAction(w); Assert.AreEqual("<poker />", sw.ToString(), "A1"); // test with a target a.Target = "foo"; sw = new StringWriter(); w = new ScriptTextWriterPoker(sw); a.Writer = sw; a.RenderAction(w); Assert.AreEqual("<poker target=\"foo\" />", sw.ToString(), "A2"); // test with a target and id a.ID = "poker_action"; a.Target = "foo"; sw = new StringWriter(); w = new ScriptTextWriterPoker(sw); a.Writer = sw; a.RenderAction(w); Assert.AreEqual("<poker id=\"poker_action\" target=\"foo\" />", sw.ToString(), "A3"); }
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 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 CloseAfterClose() { ActionPoker a = new ActionPoker(); ScriptTypeDescriptor td = new ScriptTypeDescriptor(a); td.Close(); td.Close(); }
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 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 AddAfterClose() { ActionPoker a = new ActionPoker(); ScriptTypeDescriptor td = new ScriptTypeDescriptor(a); td.Close(); td.AddEvent(new ScriptEventDescriptor("testEvent", true)); }
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"); }
public void TypeDescriptor() { ActionPoker a = new ActionPoker(); ScriptTypeDescriptor desc = ((IScriptObject)a).GetTypeDescriptor(); Assert.AreEqual(a, desc.ScriptObject, "A1"); // events IEnumerable <ScriptEventDescriptor> events = desc.GetEvents(); Assert.IsNotNull(events, "A2"); IEnumerator <ScriptEventDescriptor> ee = events.GetEnumerator(); Assert.IsTrue(ee.MoveNext()); DoEvent(ee.Current, "propertyChanged", true); Assert.IsFalse(ee.MoveNext()); // methods IEnumerable <ScriptMethodDescriptor> methods = desc.GetMethods(); Assert.IsNotNull(methods, "A3"); IEnumerator <ScriptMethodDescriptor> me = methods.GetEnumerator(); Assert.IsFalse(me.MoveNext()); // properties IEnumerable <ScriptPropertyDescriptor> props = desc.GetProperties(); Assert.IsNotNull(props, "A4"); IEnumerator <ScriptPropertyDescriptor> pe = props.GetEnumerator(); Assert.IsTrue(pe.MoveNext(), "A5"); DoProperty(pe.Current, "bindings", ScriptType.Array, true, "Bindings"); Assert.IsTrue(pe.MoveNext(), "A6"); DoProperty(pe.Current, "dataContext", ScriptType.Object, false, ""); Assert.IsTrue(pe.MoveNext(), "A7"); DoProperty(pe.Current, "id", ScriptType.String, false, "ID"); Assert.IsTrue(pe.MoveNext(), "A8"); DoProperty(pe.Current, "eventArgs", ScriptType.Object, false, ""); Assert.IsTrue(pe.MoveNext(), "A9"); DoProperty(pe.Current, "result", ScriptType.Object, false, ""); Assert.IsTrue(pe.MoveNext(), "A10"); DoProperty(pe.Current, "sender", ScriptType.Object, false, ""); Assert.IsTrue(pe.MoveNext(), "A11"); DoProperty(pe.Current, "sequence", ScriptType.Enum, false, "Sequence"); Assert.IsTrue(pe.MoveNext(), "A12"); DoProperty(pe.Current, "target", ScriptType.Object, false, "Target"); Assert.IsFalse(pe.MoveNext(), "A13"); }
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 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"); }
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"); }
public void Properties() { ActionPoker a = new ActionPoker(); // default Assert.AreEqual("", a.Target, "A1"); Assert.AreEqual(ActionSequence.AfterEventHandler, a.Sequence, "A2"); // getter/setter a.Target = "foo"; Assert.AreEqual("foo", a.Target, "A3"); a.Sequence = ActionSequence.BeforeEventHandler; Assert.AreEqual(ActionSequence.BeforeEventHandler, a.Sequence, "A4"); // setting to null a.Target = null; Assert.AreEqual("", a.Target, "A5"); }
public void EmptyLists () { ActionPoker a = new ActionPoker(); ScriptTypeDescriptor td = new ScriptTypeDescriptor (a); IEnumerable<ScriptEventDescriptor> events; IEnumerable<ScriptMethodDescriptor> methods; IEnumerable<ScriptPropertyDescriptor> props; events = td.GetEvents(); Assert.IsNotNull (events, "A1"); Assert.IsFalse (events.GetEnumerator().MoveNext(), "A2"); methods = td.GetMethods(); Assert.IsNotNull (methods, "A3"); Assert.IsFalse (methods.GetEnumerator().MoveNext(), "A4"); props = td.GetProperties(); Assert.IsNotNull (props, "A5"); Assert.IsFalse (props.GetEnumerator().MoveNext(), "A6"); }
public void EmptyLists() { ActionPoker a = new ActionPoker(); ScriptTypeDescriptor td = new ScriptTypeDescriptor(a); IEnumerable <ScriptEventDescriptor> events; IEnumerable <ScriptMethodDescriptor> methods; IEnumerable <ScriptPropertyDescriptor> props; events = td.GetEvents(); Assert.IsNotNull(events, "A1"); Assert.IsFalse(events.GetEnumerator().MoveNext(), "A2"); methods = td.GetMethods(); Assert.IsNotNull(methods, "A3"); Assert.IsFalse(methods.GetEnumerator().MoveNext(), "A4"); props = td.GetProperties(); Assert.IsNotNull(props, "A5"); Assert.IsFalse(props.GetEnumerator().MoveNext(), "A6"); }
public void TypeDescriptor () { ActionPoker a = new ActionPoker (); ScriptTypeDescriptor desc = ((IScriptObject)a).GetTypeDescriptor (); Assert.AreEqual (a, desc.ScriptObject, "A1"); // events IEnumerable<ScriptEventDescriptor> events = desc.GetEvents(); Assert.IsNotNull (events, "A2"); IEnumerator<ScriptEventDescriptor> ee = events.GetEnumerator(); Assert.IsTrue (ee.MoveNext()); DoEvent (ee.Current, "propertyChanged", true); Assert.IsFalse (ee.MoveNext()); // methods IEnumerable<ScriptMethodDescriptor> methods = desc.GetMethods(); Assert.IsNotNull (methods, "A3"); IEnumerator<ScriptMethodDescriptor> me = methods.GetEnumerator(); Assert.IsFalse (me.MoveNext ()); // properties IEnumerable<ScriptPropertyDescriptor> props = desc.GetProperties(); Assert.IsNotNull (props, "A4"); IEnumerator<ScriptPropertyDescriptor> pe = props.GetEnumerator(); Assert.IsTrue (pe.MoveNext(), "A5"); DoProperty (pe.Current, "bindings", ScriptType.Array, true, "Bindings"); Assert.IsTrue (pe.MoveNext(), "A6"); DoProperty (pe.Current, "dataContext", ScriptType.Object, false, ""); Assert.IsTrue (pe.MoveNext(), "A7"); DoProperty (pe.Current, "id", ScriptType.String, false, "ID"); Assert.IsTrue (pe.MoveNext(), "A8"); DoProperty (pe.Current, "eventArgs", ScriptType.Object, false, ""); Assert.IsTrue (pe.MoveNext(), "A9"); DoProperty (pe.Current, "result", ScriptType.Object, false, ""); Assert.IsTrue (pe.MoveNext(), "A10"); DoProperty (pe.Current, "sender", ScriptType.Object, false, ""); Assert.IsTrue (pe.MoveNext(), "A11"); DoProperty (pe.Current, "sequence", ScriptType.Enum, false, "Sequence"); Assert.IsTrue (pe.MoveNext(), "A12"); DoProperty (pe.Current, "target", ScriptType.Object, false, "Target"); Assert.IsFalse (pe.MoveNext(), "A13"); }
public void IsTypeDescriptorClosed () { ActionPoker a = new ActionPoker (); ScriptTypeDescriptor desc = ((IScriptObject)a).GetTypeDescriptor (); desc.AddEvent (new ScriptEventDescriptor ("testEvent", true)); }
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"); }
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 CloseAfterClose () { ActionPoker a = new ActionPoker(); ScriptTypeDescriptor td = new ScriptTypeDescriptor (a); td.Close (); td.Close (); }
public void AddAfterClose () { ActionPoker a = new ActionPoker(); ScriptTypeDescriptor td = new ScriptTypeDescriptor (a); td.Close (); td.AddEvent (new ScriptEventDescriptor ("testEvent", true)); }
public void Render () { ActionPoker a = new ActionPoker (); StringWriter sw; ScriptTextWriter w; // test an empty action sw = new StringWriter(); w = new ScriptTextWriterPoker (sw); a.Writer = sw; a.RenderAction (w); Assert.AreEqual ("<poker />", sw.ToString(), "A1"); // test with a target a.Target = "foo"; sw = new StringWriter(); w = new ScriptTextWriterPoker (sw); a.Writer = sw; a.RenderAction (w); Assert.AreEqual ("<poker target=\"foo\" />", sw.ToString(), "A2"); // test with a target and id a.ID = "poker_action"; a.Target = "foo"; sw = new StringWriter(); w = new ScriptTextWriterPoker (sw); a.Writer = sw; a.RenderAction (w); Assert.AreEqual ("<poker id=\"poker_action\" target=\"foo\" />", sw.ToString(), "A3"); }
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 Null_Ctor2 () { ActionPoker a = new ActionPoker(); ScriptEvent e = new ScriptEvent (a, null, true); }
public void Null_Ctor2() { ActionPoker a = new ActionPoker(); ScriptEvent e = new ScriptEvent(a, null, true); }
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 ScriptObject() { ActionPoker a = new ActionPoker(); ScriptTypeDescriptor td = new ScriptTypeDescriptor (a); Assert.AreEqual (a, td.ScriptObject, "A1"); }
public void Properties () { ActionPoker a = new ActionPoker (); // default Assert.AreEqual ("", a.Target, "A1"); Assert.AreEqual (ActionSequence.AfterEventHandler, a.Sequence, "A2"); // getter/setter a.Target = "foo"; Assert.AreEqual ("foo", a.Target, "A3"); a.Sequence = ActionSequence.BeforeEventHandler; Assert.AreEqual (ActionSequence.BeforeEventHandler, a.Sequence, "A4"); // setting to null a.Target = null; Assert.AreEqual ("", a.Target, "A5"); }