public void Render () { PropertyFilter f = new PropertyFilter (); StringWriter sw; ScriptTextWriter w; sw = new StringWriter(); w = new ScriptTextWriter (sw); f.Property = "Property"; f.Value = "Value"; ((IScriptComponent)f).RenderScript (w); Assert.AreEqual ("<propertyFilter property=\"Property\" value=\"Value\" />", sw.ToString(), "A1"); }
public void Properties () { PropertyFilter f = new PropertyFilter (); // default Assert.AreEqual ("propertyFilter", f.TagName, "A1"); Assert.AreEqual ("", f.Property, "A2"); Assert.AreEqual ("", f.Value, "A3"); // getter/setter f.Property = "Property"; Assert.AreEqual ("Property", f.Property, "A4"); f.Value = "Value"; Assert.AreEqual ("Value", f.Value, "A5"); // null setter f.Property = null; Assert.AreEqual ("", f.Property, "A6"); f.Value = null; Assert.AreEqual ("", f.Value, "A7"); }
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"); }