public void RunAfterAll(nspec instance) { // context-level if (AfterAll != null && AfterAllAsync != null) { throw new AsyncMismatchException( "A single context cannot set both an 'afterAll' and an 'afterAllAsync', please pick one of the two"); } if (AfterAll != null && AfterAll.IsAsync()) { throw new AsyncMismatchException( "'afterAll' cannot be set to an async delegate, please use 'afterAllAsync' instead"); } AfterAll.SafeInvoke(); AfterAllAsync.SafeInvoke(); // class (method-level) if (AfterAllInstance != null && AfterAllInstanceAsync != null) { throw new AsyncMismatchException( "A spec class with all its ancestors cannot set both sync and async class-level 'after_all' hooks, they should either be all sync or all async"); } AfterAllInstance.SafeInvoke(instance); AfterAllInstanceAsync.SafeInvoke(instance); }
public void RunAfterAll(nspec instance) { // context-level if (AfterAll != null && AfterAllAsync != null) { throw new ArgumentException("A single context cannot have both an 'afterAll' and an 'afterAllAsync' set, please pick one of the two"); } AfterAll.SafeInvoke(); AfterAllAsync.SafeInvoke(); // class (method-level) if (AfterAllInstance != null && AfterAllInstanceAsync != null) { throw new ArgumentException("A single class cannot have both a sync and an async class-level 'after_all' set, please pick one of the two"); } AfterAllInstance.SafeInvoke(instance); AfterAllInstanceAsync.SafeInvoke(instance); }