public void CurrentThreadInvokerInvokesOnACurrentThread() { Thread invokeThread = null; string invokedWith = null; var action = new Action <string>(arg => { invokedWith = arg; invokeThread = Thread.CurrentThread; }); var sub = new Subscription(action); CurrentThreadInvoker.GetInstance().Invoke(sub, "Hello"); Assert.IsNotNull(invokeThread); Assert.IsNotNull(invokedWith); Assert.AreEqual(Thread.CurrentThread, invokeThread); Assert.AreEqual("Hello", invokedWith); }
public void CurrentThreadInvokerIsASingleton() { Assert.IsTrue(ReferenceEquals(CurrentThreadInvoker.GetInstance(), CurrentThreadInvoker.GetInstance())); }