Beispiel #1
0
        public void GetAllMessages_NoMessages()
        {
            // Arrange
            const string ExpectedResult = "Exception Message: ";
            var          exception      = new System.Exception(string.Empty);

            // Act
            var result = exception.GetAllMessages();

            // Assert
            Assert.AreEqual(ExpectedResult, result);
        }
Beispiel #2
0
        public void GetAllMessages_OneMessageNoLabels()
        {
            // Arrange
            const string ExceptionMessage = "IPSUM LOREM";
            const string ExpectedResult   = ExceptionMessage;
            var          exception        = new System.Exception(ExceptionMessage);

            // Act
            var result = exception.GetAllMessages(false);

            // Assert
            Assert.AreEqual(ExpectedResult, result);
        }
Beispiel #3
0
        public void GetAllMessages_OneMessage()
        {
            // Arrange
            const string ExceptionMessage = "IPSUM LOREM";
            var          expectedResult   = $"Exception Message: {ExceptionMessage}";
            var          exception        = new System.Exception(ExceptionMessage);

            // Act
            var result = exception.GetAllMessages();

            // Assert
            Assert.AreEqual(expectedResult, result);
        }
Beispiel #4
0
        public void GetAllMessages_ManyMessages()
        {
            // Arrange
            const string ExceptionMessage1 = "IPSUM1 LOREM1";
            const string ExceptionMessage2 = "IPSUM2 LOREM2";
            const string ExceptionMessage3 = "IPSUM3 LOREM3";
            const string ExceptionMessage4 = "IPSUM4 LOREM4";
            var          expectedResult    = string.Format(
                "Exception Message: {0}{1}{2}{1}{3}{1}{4}",
                ExceptionMessage1,
                ", Inner Exception Message: ",
                ExceptionMessage2,
                ExceptionMessage3,
                ExceptionMessage4);
            var exception = new System.Exception(
                ExceptionMessage1, new System.Exception(ExceptionMessage2, new System.Exception(ExceptionMessage3, new System.Exception(ExceptionMessage4))));

            // Act
            var result = exception.GetAllMessages();

            // Assert
            Assert.AreEqual(expectedResult, result);
        }