Exemple #1
0
	public void TestTopLevelWithClassNameAndNamespace()
	{
		code = "<ConsoleApp xmlns=\"console\" xmlns:x=\"http://schemas.microsoft.com/winfx/xaml/2005\" x:Class=\"Test.Thing.nnn\">\n"+
			"</ConsoleApp>";
		ConsoleApp app = new ConsoleApp();
		compare(app);
	}
Exemple #2
0
 public override int GetHashCode()
 {
     return(variable.GetHashCode() + prompt.GetHashCode() + ConsoleApp.GetRepetitions(this).GetHashCode());
 }
Exemple #3
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);
	}
Exemple #4
0
	private void compare(ConsoleApp expected)
	{
		string mapping = "<?Mapping ClrNamespace=\"Xaml.TestVocab.Console\" Assembly=\"./TestVocab.dll\" XmlNamespace=\"console\" ?>\n";
		object actual = Parser.LoadXml(new XmlTextReader(new StringReader(mapping + code)));
		Assert.AreEqual(expected, actual);
	}
Exemple #5
0
	public void TestTopLevel()
	{
		code = "<ConsoleApp xmlns=\"console\"></ConsoleApp>";
		ConsoleApp app = new ConsoleApp();
		compare(app);
	}
Exemple #6
0
	public void TestObjectAsDependencyPropertyValue()
	{
		code = "<ConsoleApp xmlns=\"console\" xmlns:x=\"http://schemas.microsoft.com/winfx/xaml/2005\">\n"+
			"<ConsoleReader>\n" +
			"<ConsoleApp.Repetitions><ConsoleValueString Text=\"3\" /></ConsoleApp.Repetitions>\n" +
			"</ConsoleReader>\n" +
			"</ConsoleApp>";

		ConsoleApp app = new ConsoleApp();
		ConsoleReader reader = new ConsoleReader();
		app.AddChild(reader);
		ConsoleApp.SetRepetitions(reader, 3);
		
		compare(app);
	}
Exemple #7
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);
	}
Exemple #8
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);
	}
Exemple #9
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);
	}
Exemple #10
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);							
	}