Ejemplo n.º 1
0
        public void BasicFilter()
        {
            var exceptionFiltered = false;
            var exception = new ComplexException("message", true);
            var thrower = new ExceptionThrower(exception);

            try
            {
                thrower.Throw();
            }
            catch (ComplexException caught) when (caught.CriticalError)
            {
                exceptionFiltered = true;
            }

            Assert.IsTrue(exceptionFiltered);
        }
Ejemplo n.º 2
0
        public void BasicFilter()
        {
            var exceptionFiltered = false;
            var exception         = new ComplexException("message", true);
            var thrower           = new ExceptionThrower(exception);

            try
            {
                thrower.Throw();
            }
            catch (ComplexException caught) when(caught.CriticalError)
            {
                exceptionFiltered = true;
            }

            Assert.IsTrue(exceptionFiltered);
        }
Ejemplo n.º 3
0
        public void ComplexFilter()
        {
            var uniquePhrase = "Test_For_Uniqueness";
            var exceptionFiltered = false;
            var exceptionCollection = new List<Exception> { new Exception ("exception One"), new Exception(uniquePhrase) };
            var exception = new ComplexException("Message", false, exceptionCollection);
            var thrower = new ExceptionThrower(exception);

            try
            {
                thrower.Throw();
            }
            catch (ComplexException caught) when (!caught.NestedExceptions.Any())
            {
                Assert.Fail("Should not get to this part.");
            }
            catch (ComplexException caught) when (caught.NestedExceptions.Any(nested => nested.Message.Contains(uniquePhrase)))
            {
                exceptionFiltered = true;
            }

            Assert.IsTrue(exceptionFiltered);
        }