示例#1
0
        public void FormatException_ValidLog_ExpectedTextIsReturned()
        {
            // Arrange
            var filters   = this.GetDefaultFilters();
            var formatter = new DefaultFormatter();
            var ex        = this.GenerateExceptionWithStackTrace();
            var entry     = new ExceptionTrace(ex, DateTime.Parse("2022-10-22 22:22:31.678"));

            var expectedText = "[Exception] 22:22:31.678 Attempted to divide by zero.";

            // Act
            var outputText = formatter.FormatException(22, 1, 33, entry, filters);

            // Assert
            Assert.That(outputText, Is.Not.Empty, "Expected a string to be returned");
            Assert.That(outputText, Is.EqualTo(expectedText), "Not the expected output text, you may need to adjust the test if the formatter has been changed.");
        }