示例#1
0
	public void TestSimplestAddChild()
	{

		code = "<ConsoleApp xmlns=\"console\" xmlns:x=\"http://schemas.microsoft.com/winfx/xaml/2005\">\n"+
			"<ConsoleWriter></ConsoleWriter>" +
			"</ConsoleApp>";
		ConsoleApp app = new ConsoleApp();
		ConsoleWriter writer = new ConsoleWriter();
		app.AddChild(writer);

		compare(app);
	}
示例#2
0
	public void TestKeyAndStaticResource()
	{
		code = "<ConsoleApp xmlns=\"console\" xmlns:x=\"http://schemas.microsoft.com/winfx/xaml/2005\">\n"+
			"<ConsoleWriter Text=\"xyz\" x:Key=\"foobar\" />\n" +
			"<ConsoleReader Prompt=\"{StaticResource foobar}\" />\n" +
			"</ConsoleApp>";

		ConsoleApp app = new ConsoleApp();
		ConsoleWriter writer = new ConsoleWriter();
		writer.Text = new ConsoleValueString("xyz");
		app.AddChild(writer);
		ConsoleReader reader = new ConsoleReader();
		app.AddChild(reader);
		reader.Prompt = writer;
		
		compare(app);
	}
示例#3
0
	public void TestDependencyProperty()
	{
		code = "<ConsoleApp xmlns=\"console\" xmlns:x=\"http://schemas.microsoft.com/winfx/xaml/2005\">\n"+
			"<ConsoleWriter ConsoleApp.Repetitions=\"3\" />" +
			"</ConsoleApp>";

		ConsoleApp app = new ConsoleApp();
		ConsoleWriter writer = new ConsoleWriter();
		ConsoleApp.SetRepetitions(writer, 3);
		app.AddChild(writer);

		compare(app);
	}
示例#4
0
	public void TestObjectAsPropertyValue()
	{
		code = "<ConsoleApp xmlns=\"console\" xmlns:x=\"http://schemas.microsoft.com/winfx/xaml/2005\">\n"+
		"<ConsoleReader>\n" +
		"<ConsoleReader.Prompt><ConsoleWriter /></ConsoleReader.Prompt>\n" +
		"</ConsoleReader>\n" +
		"</ConsoleApp>";
		ConsoleApp app = new ConsoleApp();
		ConsoleReader reader = new ConsoleReader();
		app.AddChild(reader);
		ConsoleWriter writer = new ConsoleWriter();
		reader.Prompt = writer;
		compare(app);
	}
示例#5
0
	public void TestTextProperty()
	{
		code = "<ConsoleApp xmlns=\"console\" xmlns:x=\"http://schemas.microsoft.com/winfx/xaml/2005\">\n"+
			"<ConsoleWriter Text=\"Hello\" />" +
			"</ConsoleApp>";

		ConsoleApp app = new ConsoleApp();
		ConsoleWriter writer = new ConsoleWriter();
		writer.Text = new ConsoleValueString("Hello");
		app.AddChild(writer);

		compare(app);							
	}