public void ConvertAssertToException_OldStyle() { using (AssertRouter e = new AssertRouter(AssertUIBehaviour.DisableUIAndThrowExceptions)) { Debug.Fail("Assert"); } }
public void LocalSupressorRestoresPreviousSameSettings() { bool localSupressorTriggersException = false; try { using (AssertRouter localSupressor = new AssertRouter(AssertUIBehaviour.DisableUIAndThrowExceptions)) { Debug.Fail("Assert"); } } catch (AssertTriggeredException) { localSupressorTriggersException = true; } Assert.IsTrue(localSupressorTriggersException, "The local supressor should have triggered an exception"); // The local supressor should restore the original settings, // (which is that of the global supressor), so this should // still throw an exception. Debug.Fail("Assert"); }
public void InnerSupressorRestoresPreviousSameSettings_OldStyle() { using (AssertRouter outerSupressor = new AssertRouter(AssertUIBehaviour.DisableUIAndThrowExceptions)) { bool innerSupressorTriggersException = false; try { using (AssertRouter innerSupressor = new AssertRouter(AssertUIBehaviour.DisableUIAndThrowExceptions)) { Debug.Fail("Assert"); } } catch (AssertTriggeredException) { innerSupressorTriggersException = true; } Assert.IsTrue(innerSupressorTriggersException, "The local supressor should have triggered an exception"); // The inner supressor should restore the original settings, // so this should still throw an exception. Debug.Fail("Assert"); } }
public void SupressAssert_OldStyle() { // This should supress the assertion UI. // If it doesn't the test will display the UI and hang. using (AssertRouter s = new AssertRouter(AssertUIBehaviour.DisableUI)) { Debug.Fail("Assert"); } }
public static void MyClassInitialize(TestContext testContext) { _exceptionConvertor = new AssertRouter(AssertUIBehaviour.DisableUIAndThrowExceptions); }