public void Error_With_Message_Traces() { // Arrange TestTraceWriter traceWriter = new TestTraceWriter(); HttpRequestMessage request = new HttpRequestMessage(); TraceRecord[] expectedTraces = new TraceRecord[] { new TraceRecord(request, "testCategory", TraceLevel.Error) { Kind = TraceKind.Trace, Message = "The formatted message" }, }; // Act traceWriter.Error(request, "testCategory", "The {0} message", "formatted"); // Assert Assert.Equal <TraceRecord>(expectedTraces, traceWriter.Traces, new TraceRecordComparer()); }
public void Error_With_Exception_Traces() { // Arrange TestTraceWriter traceWriter = new TestTraceWriter(); HttpRequestMessage request = new HttpRequestMessage(); InvalidOperationException exception = new InvalidOperationException(); TraceRecord[] expectedTraces = new TraceRecord[] { new TraceRecord(request, "testCategory", TraceLevel.Error) { Kind = TraceKind.Trace, Exception = exception }, }; // Act traceWriter.Error(request, "testCategory", exception); // Assert Assert.Equal <TraceRecord>(expectedTraces, traceWriter.Traces, new TraceRecordComparer()); }
public void Error_With_Message_And_Exception_Traces() { // Arrange TestTraceWriter traceWriter = new TestTraceWriter(); HttpRequestMessage request = new HttpRequestMessage(); InvalidOperationException exception = new InvalidOperationException(); TraceRecord[] expectedTraces = new TraceRecord[] { new TraceRecord(request, "testCategory", TraceLevel.Error) { Kind = TraceKind.Trace, Message = "The formatted message", Exception = exception }, }; // Act traceWriter.Error(request, "testCategory", exception, "The {0} message", "formatted"); // Assert Assert.Equal<TraceRecord>(expectedTraces, traceWriter.Traces, new TraceRecordComparer()); }