Example #1
0
        public void TypeDescriptor()
        {
            SetPropertyAction    a    = new SetPropertyAction();
            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.IsTrue(pe.MoveNext(), "A13");
            DoProperty(pe.Current, "property", ScriptType.String, false, "Property");
            Assert.IsTrue(pe.MoveNext(), "A14");
            DoProperty(pe.Current, "propertyKey", ScriptType.String, false, "PropertyKey");
            Assert.IsTrue(pe.MoveNext(), "A15");
            DoProperty(pe.Current, "value", ScriptType.String, false, "Value");
            Assert.IsFalse(pe.MoveNext(), "A16");
        }
Example #2
0
        public void TypeDescriptor()
        {
            Binding b = new Binding();
            ScriptTypeDescriptor desc = ((IScriptObject)b).GetTypeDescriptor();

            Assert.AreEqual(b, desc.ScriptObject, "A1");

            // events
            IEnumerable <ScriptEventDescriptor> events = desc.GetEvents();

            Assert.IsNotNull(events, "A2");

            IEnumerator <ScriptEventDescriptor> ee = events.GetEnumerator();

            Assert.IsTrue(ee.MoveNext(), "A3");
            DoEvent(ee.Current, "transform", false);
            Assert.IsFalse(ee.MoveNext(), "A4");

            // methods
            IEnumerable <ScriptMethodDescriptor> methods = desc.GetMethods();

            Assert.IsNotNull(methods, "A5");

            IEnumerator <ScriptMethodDescriptor> me = methods.GetEnumerator();

            Assert.IsTrue(me.MoveNext(), "A6");
            DoMethod(me.Current, "evaluateIn", new string[0]);
            Assert.IsTrue(me.MoveNext(), "A6");
            DoMethod(me.Current, "evaluateOut", new string[0]);
            Assert.IsFalse(me.MoveNext(), "A7");

            // properties
            IEnumerable <ScriptPropertyDescriptor> props = desc.GetProperties();

            Assert.IsNotNull(props, "A8");

            IEnumerator <ScriptPropertyDescriptor> pe = props.GetEnumerator();

            Assert.IsTrue(pe.MoveNext(), "A8");
            DoProperty(pe.Current, "automatic", ScriptType.Boolean, false, "Automatic");
            Assert.IsTrue(pe.MoveNext(), "A9");
            DoProperty(pe.Current, "dataContext", ScriptType.Object, false, "DataContext");
            Assert.IsTrue(pe.MoveNext(), "A7");
            DoProperty(pe.Current, "dataPath", ScriptType.String, false, "DataPath");
            Assert.IsTrue(pe.MoveNext(), "A8");
            DoProperty(pe.Current, "direction", ScriptType.Enum, false, "Direction");
            Assert.IsTrue(pe.MoveNext(), "A9");
            DoProperty(pe.Current, "id", ScriptType.String, false, "ID");
            Assert.IsTrue(pe.MoveNext(), "A10");
            DoProperty(pe.Current, "property", ScriptType.String, false, "Property");
            Assert.IsTrue(pe.MoveNext(), "A11");
            DoProperty(pe.Current, "propertyKey", ScriptType.String, false, "PropertyKey");
            Assert.IsTrue(pe.MoveNext(), "A12");
            DoProperty(pe.Current, "transformerArgument", ScriptType.String, false, "TransformerArgument");
            Assert.IsFalse(pe.MoveNext(), "A13");
        }
Example #3
0
        public void TypeDescriptor()
        {
            DragDropList         a    = new DragDropList();
            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(), "A3");
            DoEvent(ee.Current, "propertyChanged", true);
            Assert.IsFalse(ee.MoveNext(), "A4");

            // methods
            IEnumerable <ScriptMethodDescriptor> methods = desc.GetMethods();

            Assert.IsNotNull(methods, "A5");

            IEnumerator <ScriptMethodDescriptor> me = methods.GetEnumerator();

            Assert.IsFalse(me.MoveNext());

            // properties
            IEnumerable <ScriptPropertyDescriptor> props = desc.GetProperties();

            Assert.IsNotNull(props, "A6");

            IEnumerator <ScriptPropertyDescriptor> pe = props.GetEnumerator();

            Assert.IsTrue(pe.MoveNext(), "A7");
            DoProperty(pe.Current, "bindings", ScriptType.Array, true, "Bindings");
            Assert.IsTrue(pe.MoveNext(), "A8");
            DoProperty(pe.Current, "dataContext", ScriptType.Object, false, "");
            Assert.IsTrue(pe.MoveNext(), "A9");
            DoProperty(pe.Current, "id", ScriptType.String, false, "ID");
            Assert.IsTrue(pe.MoveNext(), "A9");
            DoProperty(pe.Current, "acceptedDataTypes", ScriptType.Array, false, "AcceptedDataTypes");
            Assert.IsTrue(pe.MoveNext(), "A10");
            DoProperty(pe.Current, "dataType", ScriptType.String, false, "DataType");
            Assert.IsTrue(pe.MoveNext(), "A11");
            DoProperty(pe.Current, "dragMode", ScriptType.Enum, false, "DragMode");
            Assert.IsTrue(pe.MoveNext(), "A12");
            DoProperty(pe.Current, "direction", ScriptType.Enum, false, "Direction");
            Assert.IsTrue(pe.MoveNext(), "A12");
            DoProperty(pe.Current, "dropCueTemplate", ScriptType.Object, false, "");
            Assert.IsTrue(pe.MoveNext(), "A13");
            DoProperty(pe.Current, "emptyTemplate", ScriptType.Object, false, "");
            Assert.IsTrue(pe.MoveNext(), "A14");
            DoProperty(pe.Current, "floatContainerTemplate", ScriptType.Object, false, "");
            Assert.IsFalse(pe.MoveNext(), "A15");
        }
Example #4
0
        public void TypeDescriptor()
        {
            HoverBehavior        a    = new HoverBehavior();
            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(), "A3");
            DoEvent(ee.Current, "propertyChanged", true);
            Assert.IsTrue(ee.MoveNext(), "A3");
            DoEvent(ee.Current, "hover", true);
            Assert.IsTrue(ee.MoveNext(), "A4");
            DoEvent(ee.Current, "unhover", true);
            Assert.IsFalse(ee.MoveNext(), "A5");

            // methods
            IEnumerable <ScriptMethodDescriptor> methods = desc.GetMethods();

            Assert.IsNotNull(methods, "A6");

            IEnumerator <ScriptMethodDescriptor> me = methods.GetEnumerator();

            Assert.IsFalse(me.MoveNext());

            // properties
            IEnumerable <ScriptPropertyDescriptor> props = desc.GetProperties();

            Assert.IsNotNull(props, "A7");

            IEnumerator <ScriptPropertyDescriptor> pe = props.GetEnumerator();

            Assert.IsTrue(pe.MoveNext(), "A8");
            DoProperty(pe.Current, "bindings", ScriptType.Array, true, "Bindings");
            Assert.IsTrue(pe.MoveNext(), "A9");
            DoProperty(pe.Current, "dataContext", ScriptType.Object, false, "");
            Assert.IsTrue(pe.MoveNext(), "A10");
            DoProperty(pe.Current, "id", ScriptType.String, false, "ID");
            Assert.IsTrue(pe.MoveNext(), "A11");
            DoProperty(pe.Current, "hoverElement", ScriptType.Object, false, "");
            Assert.IsTrue(pe.MoveNext(), "A12");
            DoProperty(pe.Current, "unhoverDelay", ScriptType.Number, false, "UnhoverDelay");
            Assert.IsFalse(pe.MoveNext(), "A13");
        }
Example #5
0
        public void TypeDescriptor()
        {
            DataSourceDropTarget a    = new DataSourceDropTarget();
            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(), "A3");
            DoEvent(ee.Current, "propertyChanged", true);
            Assert.IsFalse(ee.MoveNext(), "A4");

            // methods
            IEnumerable <ScriptMethodDescriptor> methods = desc.GetMethods();

            Assert.IsNotNull(methods, "A5");

            IEnumerator <ScriptMethodDescriptor> me = methods.GetEnumerator();

            Assert.IsFalse(me.MoveNext());

            // properties
            IEnumerable <ScriptPropertyDescriptor> props = desc.GetProperties();

            Assert.IsNotNull(props, "A6");

            IEnumerator <ScriptPropertyDescriptor> pe = props.GetEnumerator();

            Assert.IsTrue(pe.MoveNext(), "A7");
            DoProperty(pe.Current, "bindings", ScriptType.Array, true, "Bindings");
            Assert.IsTrue(pe.MoveNext(), "A8");
            DoProperty(pe.Current, "dataContext", ScriptType.Object, false, "");
            Assert.IsTrue(pe.MoveNext(), "A9");
            DoProperty(pe.Current, "id", ScriptType.String, false, "ID");
            Assert.IsTrue(pe.MoveNext(), "A9");
            DoProperty(pe.Current, "acceptedDataTypes", ScriptType.Array, false, "AcceptedDataTypes");
            Assert.IsTrue(pe.MoveNext(), "A10");
            DoProperty(pe.Current, "append", ScriptType.Boolean, false, "Append");
            Assert.IsTrue(pe.MoveNext(), "A11");
            DoProperty(pe.Current, "target", ScriptType.String, false, "Target");
            Assert.IsTrue(pe.MoveNext(), "A12");
            DoProperty(pe.Current, "property", ScriptType.String, false, "Property");
            Assert.IsFalse(pe.MoveNext(), "A13");
        }
Example #6
0
        public void TypeDescriptor()
        {
            DraggableListItem    a    = new DraggableListItem();
            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(), "A3");
            DoEvent(ee.Current, "propertyChanged", true);
            Assert.IsFalse(ee.MoveNext(), "A4");

            // methods
            IEnumerable <ScriptMethodDescriptor> methods = desc.GetMethods();

            Assert.IsNotNull(methods, "A5");

            IEnumerator <ScriptMethodDescriptor> me = methods.GetEnumerator();

            Assert.IsFalse(me.MoveNext());

            // properties
            IEnumerable <ScriptPropertyDescriptor> props = desc.GetProperties();

            Assert.IsNotNull(props, "A6");

            IEnumerator <ScriptPropertyDescriptor> pe = props.GetEnumerator();

            Assert.IsTrue(pe.MoveNext(), "A7");
            DoProperty(pe.Current, "bindings", ScriptType.Array, true, "Bindings");
            Assert.IsTrue(pe.MoveNext(), "A8");
            DoProperty(pe.Current, "dataContext", ScriptType.Object, false, "");
            Assert.IsTrue(pe.MoveNext(), "A9");
            DoProperty(pe.Current, "id", ScriptType.String, false, "ID");
            Assert.IsTrue(pe.MoveNext(), "A9");
            DoProperty(pe.Current, "data", ScriptType.Object, false, "");
            Assert.IsTrue(pe.MoveNext(), "A10");
            DoProperty(pe.Current, "handle", ScriptType.Object, false, "Handle");
            Assert.IsTrue(pe.MoveNext(), "A11");
            DoProperty(pe.Current, "dragVisualTemplate", ScriptType.Object, false, "");
            Assert.IsFalse(pe.MoveNext(), "A12");
        }
Example #7
0
        public void TypeDescriptor()
        {
            PropertyFilter       f    = new PropertyFilter();
            ScriptTypeDescriptor desc = ((IScriptObject)f).GetTypeDescriptor();

            Assert.AreEqual(f, desc.ScriptObject, "A1");

            // events
            IEnumerable <ScriptEventDescriptor> events = desc.GetEvents();

            Assert.IsNotNull(events, "A2");

            IEnumerator <ScriptEventDescriptor> ee = events.GetEnumerator();

            Assert.IsTrue(ee.MoveNext(), "A3");
            DoEvent(ee.Current, "propertyChanged", true);
            Assert.IsFalse(ee.MoveNext(), "A4");

            // methods
            IEnumerable <ScriptMethodDescriptor> methods = desc.GetMethods();

            Assert.IsNotNull(methods, "A6");

            IEnumerator <ScriptMethodDescriptor> me = methods.GetEnumerator();

            Assert.IsFalse(me.MoveNext());

            // properties
            IEnumerable <ScriptPropertyDescriptor> props = desc.GetProperties();

            Assert.IsNotNull(props, "A7");

            IEnumerator <ScriptPropertyDescriptor> pe = props.GetEnumerator();

            Assert.IsTrue(pe.MoveNext(), "A8");
            DoProperty(pe.Current, "bindings", ScriptType.Array, true, "Bindings");
            Assert.IsTrue(pe.MoveNext(), "A9");
            DoProperty(pe.Current, "dataContext", ScriptType.Object, false, "");
            Assert.IsTrue(pe.MoveNext(), "A10");
            DoProperty(pe.Current, "id", ScriptType.String, false, "ID");
            Assert.IsTrue(pe.MoveNext(), "A11");
            DoProperty(pe.Current, "property", ScriptType.String, false, "Property");
            Assert.IsTrue(pe.MoveNext(), "A12");
            DoProperty(pe.Current, "value", ScriptType.String, false, "Value");
            Assert.IsFalse(pe.MoveNext(), "A13");
        }
Example #8
0
        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");
        }
Example #9
0
        public void TypeDescriptor()
        {
            ListView             l    = new ListView();
            ScriptTypeDescriptor desc = ((IScriptObject)l).GetTypeDescriptor();

            Assert.AreEqual(l, desc.ScriptObject, "A1");

            // events
            IEnumerable <ScriptEventDescriptor> events = desc.GetEvents();

            Assert.IsNotNull(events, "A2");

            IEnumerator <ScriptEventDescriptor> ee = events.GetEnumerator();

            Assert.IsTrue(ee.MoveNext(), "A3");
            DoEvent(ee.Current, "propertyChanged", true);
            Assert.IsFalse(ee.MoveNext(), "A4");

            // methods
            string[] args;
            IEnumerable <ScriptMethodDescriptor> methods = desc.GetMethods();

            Assert.IsNotNull(methods, "A5");

            IEnumerator <ScriptMethodDescriptor> me = methods.GetEnumerator();

            Assert.IsTrue(me.MoveNext(), "A6");
            args    = new string[1];
            args[0] = "className";
            DoMethod(me.Current, "addCssClass", args);
            Assert.IsTrue(me.MoveNext(), "A7");
            DoMethod(me.Current, "focus", new string[0]);
            Assert.IsTrue(me.MoveNext(), "A8");
            DoMethod(me.Current, "scrollIntoView", new string[0]);
            Assert.IsTrue(me.MoveNext(), "A9");
            args    = new string[1];
            args[0] = "className";
            DoMethod(me.Current, "removeCssClass", args);
            Assert.IsTrue(me.MoveNext(), "A10");
            args    = new string[1];
            args[0] = "className";
            DoMethod(me.Current, "toggleCssClass", args);
            Assert.IsFalse(me.MoveNext(), "A10");

            // properties
            IEnumerable <ScriptPropertyDescriptor> props = desc.GetProperties();

            Assert.IsNotNull(props, "A11");

            IEnumerator <ScriptPropertyDescriptor> pe = props.GetEnumerator();

            Assert.IsTrue(pe.MoveNext(), "A12");
            DoProperty(pe.Current, "bindings", ScriptType.Array, true, "Bindings");
            Assert.IsTrue(pe.MoveNext(), "A13");
            DoProperty(pe.Current, "dataContext", ScriptType.Object, false, "");
            Assert.IsTrue(pe.MoveNext(), "A14");
            DoProperty(pe.Current, "id", ScriptType.String, false, "ID");
            Assert.IsTrue(pe.MoveNext(), "A15");
            DoProperty(pe.Current, "associatedElement", ScriptType.Object, true, "");
            Assert.IsTrue(pe.MoveNext(), "A16");
            DoProperty(pe.Current, "behaviors", ScriptType.Array, true, "Behaviors");
            Assert.IsTrue(pe.MoveNext(), "A17");
            DoProperty(pe.Current, "cssClass", ScriptType.String, false, "CssClass");
            Assert.IsTrue(pe.MoveNext(), "A18");
            DoProperty(pe.Current, "enabled", ScriptType.Boolean, false, "Enabled");
            Assert.IsTrue(pe.MoveNext(), "A19");
            DoProperty(pe.Current, "style", ScriptType.Object, true, "");
            Assert.IsTrue(pe.MoveNext(), "A20");
            DoProperty(pe.Current, "visible", ScriptType.Boolean, false, "Visible");
            Assert.IsTrue(pe.MoveNext(), "A21");
            DoProperty(pe.Current, "visibilityMode", ScriptType.Enum, false, "VisibilityMode");
            Assert.IsTrue(pe.MoveNext(), "A21");
            DoProperty(pe.Current, "alternatingItemCssClass", ScriptType.String, false, "AlternatingItemCssClass");
            Assert.IsTrue(pe.MoveNext(), "A22");
            DoProperty(pe.Current, "data", ScriptType.Object, false, "");
            Assert.IsTrue(pe.MoveNext(), "A23");
            DoProperty(pe.Current, "length", ScriptType.Number, true, "");
            Assert.IsTrue(pe.MoveNext(), "A24");
            DoProperty(pe.Current, "layoutTemplate", ScriptType.Object, false, "");
            Assert.IsTrue(pe.MoveNext(), "A25");
            DoProperty(pe.Current, "itemCssClass", ScriptType.String, false, "ItemCssClass");
            Assert.IsTrue(pe.MoveNext(), "A26");
            DoProperty(pe.Current, "itemTemplateParentElementId", ScriptType.String, false, "");
            Assert.IsTrue(pe.MoveNext(), "A27");
            DoProperty(pe.Current, "separatorTemplate", ScriptType.Object, false, "");
            Assert.IsTrue(pe.MoveNext(), "A28");
            DoProperty(pe.Current, "emptyTemplate", ScriptType.Object, false, "");
            Assert.IsFalse(pe.MoveNext(), "A30");
        }