public static void Call(this MethodInfo method, object target, IStep step, ITestContext context, Action <object> callback) { IEnumerable <Cell> cells = method.GetArgumentCells(); var arguments = new object[cells.Count()]; int i = 0; foreach (Cell cell in cells) { cell.ReadArgument(context, step, x => arguments[i] = x); i++; } var results = context.ResultsFor(step); if (results.HasErrors()) { return; } try { object val = method.Invoke(target, arguments); if (method.HasReturn()) { callback(val); } } catch (Exception e) { Exception ex = e.InnerException ?? e; results.CaptureException(ex.ToString()); context.IncrementExceptions(); } }
public override void Execute(IStep containerStep, ITestContext context) { Cell cell = GetCell(); object target = context.CurrentObject; try { object actual = _accessor.GetValue(target); cell.RecordActual(actual, containerStep, context); } catch (Exception e) { context.ResultsFor(containerStep).MarkExceptionField(e.ToString(), cell.Key); context.IncrementExceptions(); } }