CastleTests.Facilities.Synchronize.Components.DummyForm.AddControl C# (CSharp) Метод

AddControl() публичный Метод

public AddControl ( Control control ) : int
control System.Windows.Forms.Control
Результат int
		public virtual int AddControl(Control control)
		{
			Controls.Add(control);
			return Controls.Count;
		}
	}

Usage Example

		public void AddControl_DifferentThread_ThrowsException()
		{
			var form = new DummyForm();
			ExecuteInThread(() => form.AddControl(new Button()));
			Assert.IsNotNull(uncaughtException, "Expected an exception");

			uncaughtException = null;

			var classInCtx = new ClassUsingFormInWindowsContext();
			ExecuteInThread(() => classInCtx.DoWork(form));
			Assert.IsNotNull(uncaughtException, "Expected an exception");
		}