view Implab.Test/UnitTest1.cs @ 252:6f4630d0bcd9 v3

removed absolete Diagnostics classes
author cin
date Mon, 12 Feb 2018 07:24:31 +0300
parents 7c7e9ad6fe4a
children 34df34841225
line wrap: on
line source

using System;
using System.Diagnostics;
using System.Threading;
using Implab.Diagnostics;
using Xunit;

namespace Implab.Test
{
    using static Trace<UnitTest1>;
    public class UnitTest1
    {
        [Fact]
        public void Test1()
        {
            var listener = new TextWriterTraceListener(Console.Out);
            var source = TraceSource;
            source.Switch.Level = SourceLevels.All;

            source.Listeners.Add(listener);
            Trace.Listeners.Add(listener);

            Trace.WriteLine("Hello!");
            StartLogicalOperation();

            Trace.WriteLine("Inner");
            foreach(var x in Trace.CorrelationManager.LogicalOperationStack)
                Trace.WriteLine($"-{x}");
            Log("source event");

            listener.IndentLevel = 1;

            source.TraceData(TraceEventType.Start, 1, DateTime.Now);
            
            StopLogicalOperation();
        }
    }
}