protected virtual void setup_test(ITestScenario test) { var msg = test.Setup(); if (string.IsNullOrEmpty(msg)) { current_test = test; RND = new System.Random(DateTime.Now.Second); } else { Utils.Message(msg); } }
protected virtual void MainWindow(int windowID) { GUILayout.BeginVertical(); var old_assembly = current_assembly; current_assembly = Utils.LeftRightChooser(current_assembly, scenarios, "Select assembly"); if (old_assembly != current_assembly) { current_test_name = ""; } SortedList <string, ITestScenario> tests = null; if (scenarios.TryGetValue(current_assembly, out tests)) { current_test_name = Utils.LeftRightChooser(current_test_name, tests, "Select test to run"); } if (current_test != null) { GUILayout.BeginHorizontal(); if (GUILayout.Button("Stop", Styles.danger_button, GUILayout.ExpandWidth(true))) { stop_test(); } if (GUILayout.Button("Restart", Styles.danger_button, GUILayout.ExpandWidth(true))) { current_test.Cleanup(); current_test.Setup(); } GUILayout.EndHorizontal(); GUILayout.Label(current_test != null? current_test.Status : "", Styles.boxed_label, GUILayout.ExpandWidth(true)); } else if (tests != null) { ITestScenario scn; if (tests.TryGetValue(current_test_name, out scn)) { scn.Draw(); if (GUILayout.Button("Run the test", Styles.active_button, GUILayout.ExpandWidth(true))) { setup_test(scn); } } } GUILayout.EndVertical(); TooltipsAndDragWindow(); }