/// <summary> /// Test execution happens in three phases: this is the second phase. /// </summary> /// <remarks> /// Here all contexts and all their examples are traversed again to set proper exception /// on examples, giving priority to exceptions from: inherithed beforeAll, beforeAll, /// context (befores/ acts/ it/ afters), afterAll, inherithed afterAll. /// </remarks> public virtual void AssignExceptions(bool recurse = true) { var beforeAllException = BeforeAllChain.AnyException(); var afterAllException = AfterAllChain.AnyException(); for (int i = 0; i < runnables.Count; i++) { runnables[i].AssignException(beforeAllException, afterAllException); } if (recurse) { Contexts.Do(c => c.AssignExceptions(recurse)); } }
public override string ToString() { string levelText = $"L{Level}"; string exampleText = $"{Examples.Count} exm"; string contextText = $"{Contexts.Count} ctx"; var exception = BeforeAllChain.AnyException() ?? BeforeChain.AnyException() ?? ActChain.AnyException() ?? AfterChain.AnyException() ?? AfterAllChain.AnyException(); string exceptionText = exception?.GetType().Name ?? String.Empty; return(String.Join(",", new [] { Name, levelText, exampleText, contextText, exceptionText, })); }