private void button4_Click(object sender, EventArgs e) { var types = env.GetAllTypes(); foreach (var t in types) { CLRSharp.ICLRType_Sharp type = env.GetType(t) as CLRSharp.ICLRType_Sharp; if (type != null) { type.ResetStaticInstace(); } } int testcount = 0; int succcount = 0; foreach (TreeNode t in treeView1.Nodes) { foreach (TreeNode method in t.Nodes) { Mono.Cecil.MethodDefinition m = method.Tag as Mono.Cecil.MethodDefinition; if (m == null) { continue; } if (m.HasParameters == false && m.Name.Contains("UnitTest") && m.IsStatic) { testcount++; try { object obj = RunTest(m); method.BackColor = Color.YellowGreen; succcount++; Log("----TestOK----" + m.ToString()); } catch (Exception err) { method.BackColor = Color.Red; Log("----Test Fail----" + m.ToString()); } } } } Log("----Test Succ(" + succcount + "/" + testcount + ")----"); }
void TestAll() { logmode = 0; Log_Warning("TestAll."); //reset var types = env.GetAllTypes(); foreach (var t in types) { CLRSharp.ICLRType_Sharp type = env.GetType(t) as CLRSharp.ICLRType_Sharp; if (type != null) { type.ResetStaticInstace(); Debug.Log("Reset:" + t); } } int finish = 0; foreach (var m in tests) { if (m.bSucc && bHideRight) { continue; } try { TestOne(m.m, false, false); finish++; m.bSucc = true; m.bError = false; } catch (Exception err) { m.bError = true; m.bSucc = false; Log_Error(m.ToString() + "|||" + err.ToString()); } } Log_Warning("TestAllEnd. Count:" + finish + "/" + tests.Count); logmode = 1; }