public void BindXaml () { // Fails in Silverlight 3 Mono.Moonlight.BindingConverter c = new Mono.Moonlight.BindingConverter (); Grid p = (Grid) c.Root; Canvas canvas = (Canvas) p.Children [0]; p.Children.Clear (); TestPanel.Children.Add (canvas); Enqueue (() => { Assert.AreEqual ("Thursday, February, 2009", ((TextBlock)canvas.Children[0]).Text, "#1"); Assert.AreEqual ("converter-string", ((TextBlock)canvas.Children[1]).Text, "#2"); Assert.AreEqual ("converter-string", ((TextBlock)canvas.Children[2]).Text, "#3"); Assert.AreEqual ("converter-object", ((TextBlock)canvas.Children[3]).Text, "#4"); Assert.AreEqual ("", ((TextBlock)canvas.Children[4]).Text, "#5"); Assert.AreEqual ("null-value", ((TextBlock) canvas.Children [5]).Text, "#6"); Assert.AreEqual ("", ((TextBlock) canvas.Children [6]).Text, "#7"); }); EnqueueTestComplete (); }
public void XamlPropertyPathTest () { // FIXME: When fixing this test, the commented out checks should be replaced by another test which // verifies that parsing invalid paths from the .xaml file throws an exception. Mono.Moonlight.BindingConverter c = new Mono.Moonlight.BindingConverter (); TextBlock a = (TextBlock) c.FindName ("a"); //Assert.IsInstanceOfType (a.ReadLocalValue (TextBlock.TextProperty), typeof (BindingExpressionBase)); Assert.AreEqual ("0.5", a.Text, "#1"); //Assert.AreEqual ("", ((TextBlock) c.FindName ("b")).Text, "#2"); Assert.AreEqual ("0.5", ((TextBlock) c.FindName ("c")).Text, "#3"); //Assert.AreEqual ("", ((TextBlock) c.FindName ("d")).Text, "#4"); //Assert.AreEqual ("", ((TextBlock) c.FindName ("e")).Text, "#5"); //Assert.AreEqual ("", ((TextBlock) c.FindName ("f")).Text, "#6"); Assert.AreEqual (typeof (OpacityTest).FullName, ((TextBlock) c.FindName ("g")).Text, "#7"); Assert.AreEqual (typeof (OpacityTest).FullName, ((TextBlock) c.FindName ("h")).Text, "#8"); Assert.AreEqual ("1.5", ((TextBlock) c.FindName ("i")).Text, "#9"); }