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