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.

70<br />

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

Design test case<br />

Verify that the application block<br />

can retrieve configuration data<br />

from different sources, such<br />

as an application configuration<br />

file, a database, or from<br />

memory.<br />

Verify that the instrumentation<br />

is implemented with loosely<br />

coupled events.<br />

Verify that situations that can<br />

cause exceptions are addressed<br />

and that the application<br />

block logs the exceptions<br />

through the instrumentation.<br />

Verify that the application block<br />

supports custom property collections<br />

for the custom exception<br />

handlers.<br />

Implemented?<br />

Yes<br />

Yes<br />

Yes<br />

Yes<br />

Feature that implements design<br />

The ExceptionPolicyFactory class has a constructor<br />

that accepts a configuration source as an input<br />

parameter.<br />

The methods in the ExceptionHandlingInstrumentationProvider<br />

class that raise the events bind to<br />

the methods in the ExceptionHandlingInstrumentationListener<br />

class at run time.<br />

For example, the ExceptionPolicyImpl class,<br />

which handles the exception policies, includes the<br />

InstrumentationProvider property. This property<br />

retrieves the instrumentation provider that defines<br />

the events for exception handling. The provider<br />

logs the events to WMI and the event log.<br />

The CustomHandlerData class provides the ability<br />

to configure custom property collections for custom<br />

exception handlers.<br />

After the code is implemented, you can review it to see if it satisfies its test cases.<br />

Table 4 lists the results of a code review for the Exception Handling Application<br />

Block.<br />

Table 4: Exception Handling Application Block Code Verification<br />

Implemented?<br />

Feature that is Code test case<br />

implemented<br />

Verify that the Exception-<br />

Policy façade exposes a<br />

public method to handle<br />

the exceptions.<br />

Yes<br />

The ExceptionPolicy class is a façade that exposes<br />

the HandleException method to handle an exception.<br />

This is shown in the following code.<br />

public static bool HandleException(Exception<br />

exceptionToHandle, string policyName){}

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

Saved successfully!

Ooh no, something went wrong!