示例#1
0
        public void Fatal_With_Message_Traces()
        {
            // Arrange
            TestTraceWriter    traceWriter = new TestTraceWriter();
            HttpRequestMessage request     = new HttpRequestMessage();

            TraceRecord[] expectedTraces = new TraceRecord[]
            {
                new TraceRecord(request, "testCategory", TraceLevel.Fatal)
                {
                    Kind = TraceKind.Trace, Message = "The formatted message"
                },
            };

            // Act
            traceWriter.Fatal(request, "testCategory", "The {0} message", "formatted");

            // Assert
            Assert.Equal <TraceRecord>(expectedTraces, traceWriter.Traces, new TraceRecordComparer());
        }
示例#2
0
        public void Fatal_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.Fatal)
                {
                    Kind = TraceKind.Trace, Exception = exception
                },
            };

            // Act
            traceWriter.Fatal(request, "testCategory", exception);

            // Assert
            Assert.Equal <TraceRecord>(expectedTraces, traceWriter.Traces, new TraceRecordComparer());
        }
        public void Fatal_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.Fatal) { Kind = TraceKind.Trace, Message = "The formatted message", Exception = exception },
            };

            // Act
            traceWriter.Fatal(request, "testCategory", exception, "The {0} message", "formatted");

            // Assert
            Assert.Equal<TraceRecord>(expectedTraces, traceWriter.Traces, new TraceRecordComparer());
        }