Ejemplo n.º 1
0
 public void ConvertAssertToException_OldStyle()
 {
     using (AssertRouter e = new AssertRouter(AssertUIBehaviour.DisableUIAndThrowExceptions))
     {
         Debug.Fail("Assert");
     }
 }
Ejemplo n.º 2
0
        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");
        }
Ejemplo n.º 3
0
        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");
            }
        }
Ejemplo n.º 4
0
 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");
     }
 }
Ejemplo n.º 5
0
 public static void MyClassInitialize(TestContext testContext)
 {
     _exceptionConvertor = new AssertRouter(AssertUIBehaviour.DisableUIAndThrowExceptions);
 }