private static string TeardownDesc(TeardownMethod teardown) { if (teardown == null) { return(string.Empty); } var name = teardown.name; var returnType = teardown.returnType; if (returnType == typeof(IEnumerator)) { return(@" yield return instance." + name + @"();"); } // ret type is void. return(@" try { instance." + name + @"(); } catch (Exception e) { rec.TeardownFailed(e); throw; }"); }
public TestEntryClass(string className, MethodInfo setupMethod, MethodInfo teardownMethod, TestMethod[] methods) { this.className = className; if (setupMethod != null) { this.setupMethod = new SetupMethod(setupMethod.Name, setupMethod.ReturnType); } if (teardownMethod != null) { this.teardownMethod = new TeardownMethod(teardownMethod.Name, teardownMethod.ReturnType); } this.methods = methods; }