public void TwoInstanceDependentMethodsInvoked_Exception() { SingleThreadedMethodsObject o1 = new SingleThreadedMethodsObject(); Barrier barrier = new Barrier(2); TestHelpers.InvokeSimultaneouslyAndWait(() => o1.InstanceDependentMethod(barrier), () => o1.InstanceDependentMethod2(barrier)); }
public void TwoInstanceDependentMethodsInvoked_Exception() { SingleThreadedMethodsObject o1 = new SingleThreadedMethodsObject(); Barrier barrier = new Barrier(2); TestHelpers.InvokeSimultaneouslyAndWait(() => o1.InstanceDependentMethod(barrier), () => o1.InstanceDependentMethod2(barrier)); }
public void MethodsInvokedOnSeparateObjects_NoException() { SingleThreadedMethodsObject o1 = new SingleThreadedMethodsObject(); SingleThreadedMethodsObject o2 = new SingleThreadedMethodsObject(); TestHelpers.InvokeSimultaneouslyAndWait(() => o1.InstanceDependentMethod(new Barrier(1)), () => o2.InstanceDependentMethod(new Barrier(1))); }
public void MethodThrowsException_MonitorProperlyReleased() { SingleThreadedMethodsObject o1 = new SingleThreadedMethodsObject(); var manualResetEvent = new ManualResetEvent(false); TestHelpers.InvokeSimultaneouslyAndWait(() => { TestHelpers.Swallow <NotSupportedException>(o1.Exception); manualResetEvent.Set(); }, () => { manualResetEvent.WaitOne(); TestHelpers.Swallow <NotSupportedException>(o1.Exception); }); manualResetEvent.Reset(); TestHelpers.InvokeSimultaneouslyAndWait(() => { TestHelpers.Swallow <NotSupportedException>(o1.Exception); manualResetEvent.Set(); }, () => { manualResetEvent.WaitOne(); TestHelpers.Swallow <NotSupportedException>(() => o1.InstanceDependentMethod(new Barrier(1))); }); }
public void PrivateThreadSafeMethod_InvokedFromTwoThreads_DoesNotThrow() { SingleThreadedMethodsObject o = new SingleThreadedMethodsObject(); TestHelpers.InvokeSimultaneouslyAndWait(o.ThreadSafeMethodInvokingThreadSafePrivateMethod, o.ThreadSafeMethodInvokingThreadSafePrivateMethod); }
public void MethodThrowsException_MonitorProperlyReleased() { SingleThreadedMethodsObject o1 = new SingleThreadedMethodsObject(); var manualResetEvent = new ManualResetEvent(false); TestHelpers.InvokeSimultaneouslyAndWait(() => { TestHelpers.Swallow<NotSupportedException>(o1.Exception); manualResetEvent.Set(); }, () => { manualResetEvent.WaitOne(); TestHelpers.Swallow<NotSupportedException>(o1.Exception); }); manualResetEvent.Reset(); TestHelpers.InvokeSimultaneouslyAndWait(() => { TestHelpers.Swallow<NotSupportedException>(o1.Exception); manualResetEvent.Set(); }, () => { manualResetEvent.WaitOne(); TestHelpers.Swallow<NotSupportedException>(() => o1.InstanceDependentMethod(new Barrier(1))); }); }
public void MethodsInvokedOnSeparateObjects_NoException() { SingleThreadedMethodsObject o1 = new SingleThreadedMethodsObject(); SingleThreadedMethodsObject o2 = new SingleThreadedMethodsObject(); TestHelpers.InvokeSimultaneouslyAndWait(() => o1.InstanceDependentMethod(new Barrier(1)), () => o2.InstanceDependentMethod(new Barrier(1))); }
public void PrivateThreadSafeMethod_InvokedFromTwoThreads_DoesNotThrow() { SingleThreadedMethodsObject o = new SingleThreadedMethodsObject(); TestHelpers.InvokeSimultaneouslyAndWait(o.ThreadSafeMethodInvokingThreadSafePrivateMethod, o.ThreadSafeMethodInvokingThreadSafePrivateMethod); }