/// <summary> /// Reroutes asserts according to the specified behaviour for the duration of the provided action. /// </summary> /// <param name="assertRoutingBehaviour">The routing behaviour to apply.</param> /// <param name="routedAction">The action to disable asserts over.</param> public static void Reroute(AssertUIBehaviour assertRoutingBehaviour, Action routedAction) { bool disableAssertUI = assertRoutingBehaviour.HasFlag(AssertUIBehaviour.DisableUI); bool throwExceptions = assertRoutingBehaviour.HasFlag(AssertUIBehaviour.ThrowExceptions); AssertRouter router = new AssertRouter(assertRoutingBehaviour); try { routedAction(); } finally { router.Restore(); } }
public static void Initialise(TestContext context) { _assertRouter = new AssertRouter(true, false); }