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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

190<br />

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

Table 7: Logging Application Block Scenarios<br />

Logging mechanism<br />

Action Users Formatters Trace listeners<br />

Trace listeners Log message 1, 10, 50, 150,<br />

300<br />

Text Formatter;<br />

Binary Formatter<br />

Event Log;<br />

MSMQ<br />

Place a log<br />

message in a<br />

message queue<br />

and use the distributor<br />

service<br />

to send the message<br />

to the trace<br />

listeners.<br />

Log message 1, 10, 50, 150,<br />

300<br />

Text Formatter;<br />

Binary Formatter<br />

Event Log;<br />

MSMQ; Database;<br />

WMI; Flat<br />

File<br />

Creating the <strong>Test</strong> Harness<br />

For an example of how to create a test harness, see Building <strong>Test</strong> Harnesses. Iterations<br />

of the test should create the LogEntry object so that the cost of creating the object<br />

is included in the performance metrics. For an example of how to create a domain<br />

object for each iteration, see Using the <strong>Test</strong> Script. Create a Web page to run the test<br />

harness. Figure 4 is an example of a test harness for the Logging Application Block.<br />

Figure 4 Logging Application Block <strong>Test</strong> Harness<br />

Clicking the LogEventCategory button logs a message that is formatted with one of<br />

the formatters listed in Table 7. The application block sends the message to the trace<br />

listener that is associated with the selected category. For more information about<br />

using formatters, categories, and trace listeners, see the <strong>Enterprise</strong> <strong>Library</strong> documentation<br />

for the Logging Application Block.<br />

Creating the <strong>Test</strong> Code<br />

The test code implements the scenarios. There are two versions of the test code. One<br />

version is for <strong>Enterprise</strong> <strong>Library</strong> and the other version is for the .NET Framework.<br />

Table 8 lists the test code for the Logging Application Block.

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

Saved successfully!

Ooh no, something went wrong!