public void SetUpFixture()
		{
			using (DesignSurface designSurface = new DesignSurface(typeof(Form))) {
				IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost));
				IEventBindingService eventBindingService = new MockEventBindingService(host);
				host.AddService(typeof(IEventBindingService), eventBindingService);
				
				Form form = (Form)host.RootComponent;
				form.ClientSize = new Size(200, 300);

				PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form);
				PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false);
				namePropertyDescriptor.SetValue(form, "MainForm");
				
				// Simulate giving a name to the Load event handler in the property grid.
				EventDescriptorCollection events = TypeDescriptor.GetEvents(form);
				EventDescriptor loadEvent = events.Find("Load", false);
				PropertyDescriptor loadEventProperty = eventBindingService.GetEventProperty(loadEvent);
				loadEventProperty.SetValue(form, "MainFormLoad");
				
				// Add a second event handler method.
				EventDescriptor closedEvent = events.Find("FormClosed", false);
				PropertyDescriptor closedEventProperty = eventBindingService.GetEventProperty(closedEvent);
				closedEventProperty.SetValue(form, "MainFormClosed");

				DesignerSerializationManager serializationManager = new DesignerSerializationManager(host);
				using (serializationManager.CreateSession()) {					
					PythonCodeDomSerializer serializer = new PythonCodeDomSerializer("    ");
					generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1);
				}
			}
		}
		public void SetUpFixture()
		{
			using (DesignSurface designSurface = new DesignSurface(typeof(Form))) {
				IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost));
				IEventBindingService eventBindingService = new MockEventBindingService(host);
				host.AddService(typeof(IEventBindingService), eventBindingService);

				Form form = (Form)host.RootComponent;
				form.ClientSize = new Size(284, 264);
				
				PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form);
				PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false);
				namePropertyDescriptor.SetValue(form, "MainForm");
				
				Panel panel = (Panel)host.CreateComponent(typeof(Panel), "panel1");
				panel.Location = new Point(10, 15);
				panel.Anchor = AnchorStyles.Bottom | AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
				panel.TabIndex = 0;
				panel.Size = new Size(100, 120);
				TextBox textBox = (TextBox)host.CreateComponent(typeof(TextBox), "textBox1");
				textBox.Location = new Point(5, 5);
				textBox.TabIndex = 0;
				textBox.Size = new Size(110, 20);
				panel.Controls.Add(textBox);
				
				// Add an event handler to the panel to check that this code is generated
				// before the text box is initialized.
				EventDescriptorCollection events = TypeDescriptor.GetEvents(panel);
				EventDescriptor clickEvent = events.Find("Click", false);
				PropertyDescriptor clickEventProperty = eventBindingService.GetEventProperty(clickEvent);
				clickEventProperty.SetValue(panel, "Panel1Click");

				form.Controls.Add(panel);
				
				DesignerSerializationManager serializationManager = new DesignerSerializationManager(host);
				using (serializationManager.CreateSession()) {					
					PythonCodeDomSerializer serializer = new PythonCodeDomSerializer("    ");
					generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1);
				}
			}
		}