public static AddTransientGiven ( string testName, string context, |
||
testName | string | |
context | string | |
given | ||
return | void |
public static Tuple <T1, T2, T3> Given <T1, T2, T3>(string context) { var currentTest = new StackFrame(1).GetMethod().DeclaringType.Name; var key = currentTest + context; if (!TestRunContext.ContainsKey(key)) { var given = ((context <T1, T2, T3>)Contexts[context]); TestRunManager.AddTransientGiven(currentTest, context, given); TestRunContext.Add(key, ((context <T1, T2, T3>)Contexts[context]).Invoke()); } return((Tuple <T1, T2, T3>)TestRunContext[key]); }
public static GivenResult Given(string context) { var currentTest = new StackFrame(1).GetMethod().DeclaringType.Name; var key = currentTest + context; if (TestRunContext.ContainsKey(key)) { return new GivenResult { Executed = false } } ; TestRunManager.AddTransientGiven(currentTest, context, Contexts[context]); var given = Contexts[context]; var result = given.DynamicInvoke(); TestRunContext.Add(key, result); return(new GivenResult { Executed = true }); }