Exemple #1
0
		public void Properties ()
		{
			Binding b = new Binding ();

			// default
			Assert.AreEqual (true, b.Automatic, "A1");
			Assert.AreEqual ("", b.DataContext, "A2");
			Assert.AreEqual ("", b.DataPath, "A3");
			Assert.AreEqual (BindingDirection.In, b.Direction, "A4");
			Assert.AreEqual ("", b.ID, "A5");
			Assert.AreEqual ("", b.Property, "A6");
			Assert.AreEqual ("", b.PropertyKey, "A7");
			Assert.IsNotNull (b.Transform, "A8");
			Assert.AreEqual ("", b.TransformerArgument, "A9");

			// getter/setter
			b.Automatic = false;
			Assert.AreEqual (false, b.Automatic, "A10");
			b.DataContext = "DataContext";
			Assert.AreEqual ("DataContext", b.DataContext, "A11");
			b.DataPath = "DataPath";
			Assert.AreEqual ("DataPath", b.DataPath, "A12");
			b.Direction = BindingDirection.InOut;
			Assert.AreEqual (BindingDirection.InOut, b.Direction, "A13");
			b.ID = "ID";
			Assert.AreEqual ("ID", b.ID, "A14");
			b.Property = "Property";
			Assert.AreEqual ("Property", b.Property, "A15");
			b.PropertyKey = "PropertyKey";
			Assert.AreEqual ("PropertyKey", b.PropertyKey, "A16");
			b.TransformerArgument = "TransformerArgument";
			Assert.AreEqual ("TransformerArgument", b.TransformerArgument, "A17");

			// setting to null
			b.DataContext = null;
			Assert.AreEqual ("", b.DataContext, "A18");
			b.DataPath = null;
			Assert.AreEqual ("", b.DataPath, "A19");
			b.ID = null;
			Assert.AreEqual ("", b.ID, "A20");
			b.Property = null;
			Assert.AreEqual ("", b.Property, "A21");
			b.PropertyKey = null;
			Assert.AreEqual ("", b.PropertyKey, "A22");
			b.TransformerArgument = null;
			Assert.AreEqual ("", b.TransformerArgument, "A23");
		}
Exemple #2
0
		public void IsTypeDescriptorClosed ()
		{
			Binding b = new Binding ();
			ScriptTypeDescriptor desc = ((IScriptObject)b).GetTypeDescriptor ();

			desc.AddEvent (new ScriptEventDescriptor ("testEvent", true));
		}
Exemple #3
0
		public void Render ()
		{
			Binding b = new Binding();
			StringWriter sw = new StringWriter();
			ScriptTextWriterPoker w = new ScriptTextWriterPoker (sw);

			b.Automatic = false;
			b.DataContext = "DataContext";
			b.DataPath = "DataPath";
			b.Direction = BindingDirection.InOut;
			b.ID = "ID";
			b.Property = "Property";
			b.PropertyKey = "PropertyKey";
			b.TransformerArgument = "TransformerArgument";

			b.RenderScript (w);

			Assert.AreEqual ("<binding automatic=\"False\" dataContext=\"DataContext\" dataPath=\"DataPath\" direction=\"InOut\" id=\"ID\" property=\"Property\" propertyKey=\"PropertyKey\" transformerArgument=\"TransformerArgument\" />", sw.ToString(), "A1");
		}
Exemple #4
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");
		}
Exemple #5
0
		public void TransformEvent ()
		{
			Binding b = new Binding ();

			Assert.AreEqual ("", b.Transform.Handler, "A1");
			Assert.AreEqual (0, b.Transform.Actions.Count, "A2");
		}