18 public partial class CUITest
20 public static List<DebugConsole.Command> AddedCommands =
new List<DebugConsole.Command>();
21 public static void AddCommands()
23 AddedCommands.Add(
new DebugConsole.Command(
"cuiunittest",
"", CUIUnitTest,
24 () =>
new string[][] {
25 UnitTest.FindAllTests().Values.Select(T => T.Name).Append(
"all").ToArray()
28 AddedCommands.Add(
new DebugConsole.Command(
"cuitest",
"", CUITestCommand,
29 () =>
new string[][] {
30 CUITest.automaticTestRunner.GetClassMethodPairs().Append(
"end").Append(
"all").ToArray()
33 AddedCommands.Add(
new DebugConsole.Command(
"cuistash",
"", CUIStash,
34 () =>
new string[][] {
35 CUITest.automaticTestRunner.GetClassMethodPairs().Append(
"clear").ToArray()
38 AddedCommands.Add(
new DebugConsole.Command(
"cuimodtest",
"", CUIModTest,
39 () =>
new string[][] {
40 CUITest.fakeModRunner.FindAllFakeMods().Append(
"end").ToArray()
44 AddedCommands.Add(
new DebugConsole.Command(
"cuicoverage",
"", CUICoverage));
48 DebugConsole.Commands.InsertRange(0, AddedCommands);
51 public static void CUIUnitTest(
string[] args)
53 if (args.Length == 0) { CUITest.Log(
"mb name?");
return; }
54 UnitTest.Run(args[0], args.ElementAtOrDefault(1));
57 public static void CUIStash(
string[] args)
59 if (args.Length == 0) { CUITest.Log(
"mb name?");
return; }
61 if (String.Equals(args[0],
"clear", StringComparison.OrdinalIgnoreCase))
63 CUITest.automaticTestRunner.ClearStash();
67 CUITest.automaticTestRunner.StashTest(args[0]);
70 public static void CUITestCommand(
string[] args)
72 if (args.Length == 0) { CUITest.Log(
"mb name?");
return; }
74 if (String.Equals(args[0],
"end", StringComparison.OrdinalIgnoreCase))
76 CUITest.automaticTestRunner.StopTest();
80 if (String.Equals(args[0],
"all", StringComparison.OrdinalIgnoreCase))
82 CUITest.automaticTestRunner.RunAllTests();
86 CUITest.automaticTestRunner.RunTest(args[0]);
89 public static void CUIModTest(
string[] args)
91 if (args.Length == 0) { CUITest.Log(
"mb name?");
return; }
93 if (String.Equals(args[0],
"end", StringComparison.OrdinalIgnoreCase))
95 CUITest.fakeModRunner.StopTest();
99 CUITest.fakeModRunner.RunTest(args[0]);
102 public static void CUICoverage(
string[] args)
107 public static void RemoveCommands()
109 AddedCommands.ForEach(c => DebugConsole.Commands.Remove(c));
110 AddedCommands.Clear();