A tracing event that exposes an Exception, in addition to a message string.
Наследование: MessageTraceEvent
Пример #1
0
		public void WhenExceptionMessageHasOnlyException_ThenMessageContainsExceptionMessageAndStacktrace()
		{
			var exception = new InvalidOperationException("Foo");
			var traceEvent = new ExceptionTraceEvent(TraceEventType.Error, 0, exception);

			Assert.Contains("Foo", traceEvent.MessageOrFormat);
			Assert.Contains(exception.ToString(), traceEvent.MessageOrFormat);
		}
Пример #2
0
		public void WhenExceptionMessageHasMessageFormat_ThenMessageContainsFormattedMessageAndExceptionMessageAndStacktrace()
		{
			var exception = new InvalidOperationException("Foo");
			var traceEvent = new ExceptionTraceEvent(TraceEventType.Error, 0, exception, "Hello {0}", "World");

			Assert.Contains("Hello World", traceEvent.MessageOrFormat);
			Assert.Contains("Foo", traceEvent.MessageOrFormat);
			Assert.Contains(exception.ToString(), traceEvent.MessageOrFormat);
		}