From 43b0dc2bcd858355110814ac244bb3678f8beea0 Mon Sep 17 00:00:00 2001 From: Iain McCoy Date: Sat, 23 Jul 2005 13:27:21 +0000 Subject: 2005-07-23 Iain McCoy * Test/CodeWriter.cs: added tests for events and for delegates as property values svn path=/trunk/mcs/; revision=47587 --- mcs/class/PresentationFramework/ChangeLog | 2 + mcs/class/PresentationFramework/Test/CodeWriter.cs | 43 ++++++++++++++++++++++ 2 files changed, 45 insertions(+) (limited to 'mcs/class/PresentationFramework') diff --git a/mcs/class/PresentationFramework/ChangeLog b/mcs/class/PresentationFramework/ChangeLog index 5abbe97728d..f7e2da8cb5c 100644 --- a/mcs/class/PresentationFramework/ChangeLog +++ b/mcs/class/PresentationFramework/ChangeLog @@ -2,6 +2,8 @@ * Test/XamlParser.cs: added test for events and delegates as property values + * Test/CodeWriter.cs: added tests for events and for delegates as + property values 2005-07-19 Iain McCoy diff --git a/mcs/class/PresentationFramework/Test/CodeWriter.cs b/mcs/class/PresentationFramework/Test/CodeWriter.cs index 976f288981c..4c3ce769058 100644 --- a/mcs/class/PresentationFramework/Test/CodeWriter.cs +++ b/mcs/class/PresentationFramework/Test/CodeWriter.cs @@ -247,6 +247,49 @@ public class CodeWriterTest { ); } + [Test] + public void TestEvent() + { + cw.CreateTopLevel(typeof(ConsoleApp), null); + cw.CreateEvent(typeof(ConsoleApp).GetEvent("SomethingHappened")); + cw.CreateEventDelegate("handleSomething", typeof(SomethingHappenedHandler)); + cw.EndEvent(); + cw.EndObject(); + cw.Finish(); + compare( + "namespace DefaultNamespace {\n"+ + " public class derivedConsoleApp: Xaml.TestVocab.Console.ConsoleApp {\n" + + " private derivedConsoleApp() {\n"+ + " this.SomethingHappened += new Xaml.TestVocab.Console.SomethingHappenedHandler(this.handleSomething);\n"+ + " }\n" + + " }\n" + + "}" + ); + } + + [Test] + public void TestDelegateAsPropertyValue() + { + cw.CreateTopLevel(typeof(ConsoleApp), null); + cw.CreateObject(typeof(ConsoleWriter), null); + cw.CreateProperty(typeof(ConsoleWriter).GetProperty("Filter")); + cw.CreatePropertyDelegate("filterfilter", typeof(Filter)); + cw.EndProperty(); + cw.EndObject(); + cw.EndObject(); + cw.Finish(); + compare( + "namespace DefaultNamespace {\n"+ + " public class derivedConsoleApp: Xaml.TestVocab.Console.ConsoleApp {\n" + + " private derivedConsoleApp() {\n"+ + " Xaml.TestVocab.Console.ConsoleWriter consoleWriter1 = new Xaml.TestVocab.Console.ConsoleWriter();\n"+ + " this.AddChild(consoleWriter1);\n" + + " consoleWriter1.Filter = new Xaml.TestVocab.Console.Filter(this.filterfilter);\n" + + " }\n" + + " }\n" + + "}" + ); + } private void compare(string expected) -- cgit v1.2.3