public void TestAddDispatchTwice() { SupportDispatchable disOne = new SupportDispatchable(); service.AddExternal(disOne); service.Dispatch(); Assert.AreEqual(1, disOne.GetAndResetNumExecuted()); service.Dispatch(); Assert.AreEqual(0, disOne.GetAndResetNumExecuted()); }
public void TestAdd() { SupportDispatchable[] dispatchables = new SupportDispatchable[2]; for (int i = 0; i < dispatchables.Length; i++) { dispatchables[i] = new SupportDispatchable(); } SupportDispatchable.GetAndResetInstanceList(); service.AddExternal(dispatchables[0]); service.AddExternal(dispatchables[1]); service.Dispatch(); IList <SupportDispatchable> dispatchList = SupportDispatchable.GetAndResetInstanceList(); Assert.AreSame(dispatchables[0], dispatchList[0]); Assert.AreSame(dispatchables[1], dispatchList[1]); }
public void TestAddAndDispatch() { // Dispatch without work to do, should complete service.Dispatch(); SupportDispatchable disOne = new SupportDispatchable(); SupportDispatchable disTwo = new SupportDispatchable(); service.AddExternal(disOne); service.AddExternal(disTwo); Assert.AreEqual(0, disOne.GetAndResetNumExecuted()); Assert.AreEqual(0, disTwo.GetAndResetNumExecuted()); service.Dispatch(); service.AddExternal(disTwo); Assert.AreEqual(1, disOne.GetAndResetNumExecuted()); Assert.AreEqual(1, disTwo.GetAndResetNumExecuted()); service.Dispatch(); Assert.AreEqual(0, disOne.GetAndResetNumExecuted()); Assert.AreEqual(1, disTwo.GetAndResetNumExecuted()); }