/// <summary> /// Adds an action to perform on the fixture.<br /> /// This uses the result of the previous invocation. /// </summary> /// <param name="action">The action.</param> public ITestDefinition <TFixture> InvokeWithResult(TestActionWithResult <TFixture> action) { void Newaction(TFixture x) { action(x, GetLastResult()); InvokeResults.Add(new InvokeResult()); } InvokeList.Add(Newaction); return(this); }
/// <summary> /// Adds a function to perform on the fixture.<br /> /// </summary> /// <typeparam name="TResult">The type of the result.</typeparam> /// <param name="func">The function.</param> public ITestDefinition <TFixture> Invoke <TResult>(TestFunction <TFixture, TResult> func) { void Newaction(TFixture x) { var result = func(x); InvokeResults.Add(new InvokeResultObject(result)); } InvokeList.Add(Newaction); return(this); }
/// <summary> /// Gets the result of the last invocation, or throws an exception. /// </summary> /// <returns></returns> private object GetLastResult() { return(InvokeResults.Last().GetResult()); }