public TArranged visitBeforeAll <TArranged>(BeforeAllElement <TArranged> element, TestPosition position) { CheckNotAlreadyPastDiscovery(element); TArranged result = default(TArranged); if (position.IsOnPathTo(_targetPosition)) { _executingPastDiscovery = element; try { try { result = element.Action(); } catch (Exception e) { ReportError(position, e); } _setupResultAccumulator.AddSetupResult(position, result); } finally { _executingPastDiscovery = null; } } return(result); }
public object GetSetupResultAt(TestPosition position) { if (!position.IsOnPathTo(_targetPosition)) { throw new InvalidProgramException(); } return(_setupResultAccumulator.InternalGetSetupResultAt(position)); }
public Exception GetErrorForPosition(TestPosition position) { if (_existingError != null && _existingErrorPosition != null && _existingErrorPosition.IsOnPathTo(position)) { return(_existingError); } else { return(null); } }
protected void ReportError(TestPosition position, Exception error) { _errorAccumulator.AddError(position, error); while (error != null && position != null && position.IsOnPathTo(_targetPosition)) { _runningLock.PassAndWaitForTurn(); } }
public void visitAfterAll(AfterAllElement element, TestPosition position) { CheckNotAlreadyPastDiscovery(element); if (position.IsOnPathTo(_targetPosition)) { _setupResultAccumulator.AddCleanupAction(position, delegate { _executingCleanup = element; element.Action(); _executingCleanup = null; }); } }