Ejemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void canPeelExceptions()
        internal virtual void CanPeelExceptions()
        {
            // given
            Exception expected;
            Exception exception = new LevelOneException("", new LevelTwoException("", new LevelThreeException("", expected = new LevelThreeException("include", new LevelFourException("")))));

            // when
            Exception peeled = Exceptions.Peel(exception, item => !(item is LevelThreeException) || !item.Message.contains("include"));

            // then
            assertEquals(expected, peeled);
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldSetMessage()
        internal virtual void ShouldSetMessage()
        {
            // GIVEN
            string            initialMessage = "Initial message";
            LevelOneException exception      = new LevelOneException(initialMessage);

            // WHEN
            string prependedMessage = "Prepend this: " + exception.Message;

            Exceptions.WithMessage(exception, prependedMessage);

            // THEN
            assertEquals(prependedMessage, exception.Message);
        }