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"); }
public void AddControl_DifferentThread_ThrowsException() { DummyForm form = new DummyForm(); ExecuteInThread(delegate { form.AddControl(new Button()); }); Assert.IsNotNull(uncaughtException, "Expected an exception"); uncaughtException = null; ClassUsingFormInContext classInCtx = new ClassUsingFormInContext(); ExecuteInThread(delegate { classInCtx.DoWork(form); }); Assert.IsNotNull(uncaughtException, "Expected an exception"); }