Enterprise Library Test Guide - Willy .Net
Enterprise Library Test Guide - Willy .Net
Enterprise Library Test Guide - Willy .Net
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
58<br />
<strong>Enterprise</strong> <strong>Library</strong> <strong>Test</strong> <strong>Guide</strong><br />
Design test case Implemented? Feature that implements design<br />
Verify that the application<br />
block supports the parameter<br />
discovery feature.<br />
Yes<br />
The Database base class implements the<br />
DiscoverParameters method that dynamically<br />
discovers the parameter types.<br />
Verify that the ability to create<br />
the application block’s<br />
domain objects from configuration<br />
data follows the<br />
Dependency Injection pattern.<br />
Verify that the application<br />
block can retrieve configuration<br />
data from different sources,<br />
such as an application<br />
configuration file, a database,<br />
or from memory.<br />
Verify that the application<br />
block can manage database<br />
connection.<br />
Verify that the instrumentation<br />
is implemented with<br />
loosely coupled events.<br />
Verify that the design addresses<br />
situations that can<br />
cause exceptions and that<br />
the application block logs<br />
the exceptions through the<br />
instrumentation.<br />
Yes<br />
Yes<br />
Yes<br />
Yes<br />
Yes<br />
The DatabaseProviderFactory class<br />
derives from the NameTypeFactoryBase<br />
class, which takes the configuration source<br />
as input, creates the domain object, and<br />
injects the relevant configuration data into<br />
the domain object.<br />
The DatabaseProviderFactory class has<br />
a constructor that accepts a configuration<br />
source as an input parameter.<br />
The application block closes the database<br />
connections after it is finished with them.<br />
For example, the implementation of the<br />
ExecuteNonQuery method includes a using<br />
statement. The using statement obtains<br />
resources, executes a statement, and<br />
disposes of the resources. In this case, the<br />
resource is the database connection.<br />
In the case of the ExecuteReader method,<br />
the application block uses the Command-<br />
Behavior.CloseConnection method to close<br />
the connection after the reader closes.<br />
The methods in the DataInstrumentation-<br />
Provider class that fire the events bind to<br />
the methods in the DataInstrumentation-<br />
Listener class at run time.<br />
For example, the Database class includes<br />
the InstrumentationProvider property.<br />
This property retrieves the instrumentation<br />
provider that defines the events for the<br />
database provider. The provider logs the<br />
events to WMI and the event log.<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 Data Access Application Block.