07.11.2014 Views

Enterprise Library Test Guide - Willy .Net

Enterprise Library Test Guide - Willy .Net

Enterprise Library Test Guide - Willy .Net

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

92<br />

<strong>Enterprise</strong> <strong>Library</strong> <strong>Test</strong> <strong>Guide</strong><br />

Code test case Implemented? Feature that is implemented<br />

Verify that the Yes<br />

For example, the LogSource class increments the Trace<br />

application block<br />

Listener Entries Written/sec performance counter when<br />

uses performance<br />

it writes to a trace listener. This is shown in the following<br />

counters to<br />

code example.<br />

monitor the logging<br />

public void TraceData(TraceEventType eventType,<br />

operations, if the<br />

int id, LogEntry logEntry, TraceListenerFilter<br />

performance counters<br />

are enabled.<br />

traceListenerFilter)<br />

{<br />

…<br />

listener.TraceData(…);<br />

instrumentationProvider.FireTraceListenerEntry-<br />

WrittenEvent();<br />

…<br />

}<br />

The LoggingInstrumentationProvider class raises the<br />

traceListenerEntryWritten event. The TraceListenerEntryWritten<br />

method consumes this event and increments<br />

the performance counters. This is shown in the following<br />

code example.<br />

[InstrumentationConsumer("TraceListenerEntryWr<br />

itten")]<br />

public void TraceListenerEntryWritten(…)<br />

{<br />

if (PerformanceCountersEnabled) traceListenerEntryWritten.Increment();<br />

}

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!