Exemple #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldDetectContainsOneOfSome()
        internal virtual void ShouldDetectContainsOneOfSome()
        {
            // GIVEN
            Exception cause = new ARuntimeException(new AnotherRuntimeException(new System.NullReferenceException("Some words")));

            // THEN
            assertTrue(Exceptions.Contains(cause, typeof(System.NullReferenceException)));
            assertTrue(Exceptions.Contains(cause, "words", typeof(System.NullReferenceException)));
            assertFalse(Exceptions.Contains(cause, "not", typeof(System.NullReferenceException)));
        }
Exemple #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void canPeelUsingConveniencePredicate()
        internal virtual void CanPeelUsingConveniencePredicate()
        {
            // given
            Exception expected;
            Exception exception = new ARuntimeException(new AnotherRuntimeException(new LevelFourException("", expected = new LevelThreeException("", new LevelFourException("")))));

            // when
            Exception peeled = Exceptions.Peel(exception, Predicates.instanceOfAny(typeof(Exception), typeof(LevelFourException)));

            // then
            assertEquals(expected, peeled);
        }