public void TestGetAllMessages() { // Define variables and constants const string MESSAGE_SEPARATOR = " >>> "; Exception testException = new ApplicationException("0", new ApplicationException("1", new ApplicationException("2", new ApplicationException("3", new ApplicationException("4"))))); // Set up context // Execute string allMessages = testException.GetAllMessages(includeExceptionNames: false, messageSeparator: MESSAGE_SEPARATOR); // Assert outcome Assert.AreEqual( "0" + MESSAGE_SEPARATOR + "1" + MESSAGE_SEPARATOR + "2" + MESSAGE_SEPARATOR + "3" + MESSAGE_SEPARATOR + "4", allMessages ); }