public void TraceLogTestCreateFromAssemblyTraceSource() { ITraceSource source = new AssemblyTraceSource <TraceLogTests>(); var log = new TraceLog <GenericEventId>(source); Assert.AreEqual("Essential.Diagnostics.Tests", log.TraceSource.Name); }
public void AssemblyTraceSourceTest() { var source = new AssemblyTraceSource<AssemblyTraceSourceTests>(); var listener = source.Listeners.OfType<TestTraceListener>().First(); listener.MethodCallInformation.Clear(); source.TraceEvent(TraceEventType.Information, 1, "a1"); Assert.AreEqual("Essential.Diagnostics.Tests", source.Name); var events = listener.MethodCallInformation; Assert.AreEqual(1, events[0].Id); Assert.AreEqual("a1", events[0].Message); Assert.AreEqual(TraceEventType.Information, events[0].EventType); Assert.AreEqual("Essential.Diagnostics.Tests", events[0].Source); }
public void AssemblyTraceSourceTest() { var source = new AssemblyTraceSource <AssemblyTraceSourceTests>(); var listener = source.Listeners.OfType <TestTraceListener>().First(); listener.MethodCallInformation.Clear(); source.TraceEvent(TraceEventType.Information, 1, "a1"); Assert.AreEqual("Essential.Diagnostics.Tests", source.Name); var events = listener.MethodCallInformation; Assert.AreEqual(1, events[0].Id); Assert.AreEqual("a1", events[0].Message); Assert.AreEqual(TraceEventType.Information, events[0].EventType); Assert.AreEqual("Essential.Diagnostics.Tests", events[0].Source); }
public void AdditionalMessagesIScope() { ITraceSource source = new AssemblyTraceSource <ActivityScopeTests>(); var listener = source.Listeners.OfType <TestTraceListener>().First(); listener.MethodCallInformation.Clear(); string transferIn = "TransferIn"; string start = "Starting..."; string transferOut = "TransferOut"; string stop = "Stopping..."; using (var scope = new ActivityScope(source, 11, 12, 13, 14, transferIn, start, transferOut, stop)) { source.TraceEvent(TraceEventType.Warning, 2, "B"); } var events = listener.MethodCallInformation; StringAssert.StartsWith(events[0].Message, transferIn); Assert.AreEqual(start, events[1].Message); StringAssert.StartsWith(events[3].Message, transferOut); Assert.AreEqual(stop, events[4].Message); }
public void AdditionalMessagesIScope() { ITraceSource source = new AssemblyTraceSource<ActivityScopeTests>(); var listener = source.Listeners.OfType<TestTraceListener>().First(); listener.MethodCallInformation.Clear(); string transferIn = "TransferIn"; string start = "Starting..."; string transferOut = "TransferOut"; string stop = "Stopping..."; using (var scope = new ActivityScope(source, 11, 12, 13, 14, transferIn, start, transferOut, stop)) { source.TraceEvent(TraceEventType.Warning, 2, "B"); } var events = listener.MethodCallInformation; StringAssert.StartsWith(events[0].Message, transferIn); Assert.AreEqual(start, events[1].Message); StringAssert.StartsWith(events[3].Message, transferOut); Assert.AreEqual(stop, events[4].Message); }