public void AddControl_DifferentThread_Using_Context_ThrowsException() { var window = new DummyWindow(); var classInCtx = new ClassUsingWindowInWindowsContext(); ExecuteInThread(() => classInCtx.DoWork(window.Panel)); Assert.IsNotNull(uncaughtException, "Expected an exception"); }
public void AddControl_DifferentThread_ThrowsException() { DummyWindow window = null; ExecuteInThread(() => window = new DummyWindow()); window.AddControl(new Button()); }
public void DoWorkGeneric_DifferentThreadInContext_WorksFine() { var window = new DummyWindow(); var client = container.Resolve<IClassUsingDepedenecyContext<Panel>>(); ExecuteInThread(() => Assert.AreEqual(window, client.DoWork(window.Panel))); Assert.IsNull(uncaughtException, "Expected no exception"); }
public void AddControl_DifferentThreadInContextUsingConfiguration_UsesAmbientContext() { var window = new DummyWindow(); var client = container.Resolve<ClassUsingWindowInAmbientContext>(); ExecuteInThread(() => { var dispatcherCtx = new DispatcherSynchronizationContext(); SynchronizationContext.SetSynchronizationContext(dispatcherCtx); client.DoWork(window.Panel); }); Assert.IsNull(uncaughtException, "Expected no exception"); }
public void AddControl_DifferentThreadInContextUsingConfiguration_WorksFine() { var window = new DummyWindow(); var client = container.Resolve<ClassUsingWindow>(); ExecuteInThread(() => client.DoWork(window.Panel)); Assert.IsNull(uncaughtException, "Expected no exception"); }