public void RunTest() { loader.ReloadOnRun = false; LoadTest(assembly); loader.RunTests(); do { // TODO: Find a more robust way of handling this Thread.Sleep(500); }while(loader.Running); Assert.AreEqual(48, catcher.Events.Count); Assert.AreEqual(TestAction.RunStarting, ((TestEventArgs)catcher.Events[4]).Action); Assert.AreEqual(TestAction.RunFinished, ((TestEventArgs)catcher.Events[47]).Action); int nTests = 0; int nRun = 0; foreach (object o in catcher.Events) { TestEventArgs e = o as TestEventArgs; if (e != null && e.Action == TestAction.TestFinished) { ++nTests; if (e.Result.Executed) { ++nRun; } } } Assert.AreEqual(MockAssembly.Tests - MockAssembly.Explicit, nTests); Assert.AreEqual(MockAssembly.Tests - MockAssembly.NotRun, nRun); }
public void RunTest() { //loader.ReloadOnRun = false; LoadTest(assembly); loader.RunTests(TestFilter.Empty); do { // TODO: Find a more robust way of handling this Thread.Sleep(500); }while(!catcher.GotRunFinished); Assert.AreEqual(TestAction.ProjectLoading, ((TestEventArgs)catcher.Events[0]).Action); Assert.AreEqual(TestAction.ProjectLoaded, ((TestEventArgs)catcher.Events[1]).Action); Assert.AreEqual(TestAction.TestLoading, ((TestEventArgs)catcher.Events[2]).Action); Assert.AreEqual(TestAction.TestLoaded, ((TestEventArgs)catcher.Events[3]).Action); Assert.AreEqual(TestAction.RunStarting, ((TestEventArgs)catcher.Events[4]).Action); int eventCount = 4 /* for loading */ + 2 * (MockAssembly.Nodes - MockAssembly.Explicit); if (eventCount != catcher.Events.Count) { foreach (TestEventArgs e in catcher.Events) { Console.WriteLine(e.Action); } } Assert.AreEqual(eventCount, catcher.Events.Count); Assert.AreEqual(TestAction.RunFinished, ((TestEventArgs)catcher.Events[eventCount - 1]).Action); int nTests = 0; int nRun = 0; foreach (object o in catcher.Events) { TestEventArgs e = o as TestEventArgs; if (e != null && e.Action == TestAction.TestFinished) { ++nTests; if (e.Result.Executed) { ++nRun; } } } Assert.AreEqual(MockAssembly.ResultCount, nTests); Assert.AreEqual(MockAssembly.TestsRun, nRun); }