//event handler for test completion //keeps success/fail count and any other useful data private void TestCompleteHandler(BaseTester sender, bool success) { Debug.Assert(sender == currentTest); if (success) { testsSucceeded++; Debug.Print(sender.GetType() + " succeeded."); } else { testsFailed++; Debug.Print(sender.GetType() + " failed."); } if (tests.Count > 0) { StartNextTest(); } else { Debug.Print("All tests completed. Total: " + (testsSucceeded + testsFailed) + " Succeess: " + testsSucceeded + " Failed: " + testsFailed); Close(); } }
private void StartNextTest() { if (currentTest != null) { currentTest.OnUnload(rootState); currentTest.TestComplete -= TestCompleteHandler; } currentTest = tests.Dequeue(); currentTest.TestComplete += TestCompleteHandler; TestFailOnException(() => currentTest.OnLoad(rootState)); }
public void AddTest(BaseTester test) { tests.Enqueue(test); }