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.

196<br />

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

ID Scenario Transaction Users<br />

5 Use ExecuteNonQuery to With/Without 1, 10, 50, 150,<br />

retrieve output parameters. Transaction 300<br />

6 Use a DataSet to update the<br />

database.<br />

7 Add a new DataTable to the<br />

existing DataSet.<br />

8 Retrieve multiple rows as<br />

XML<br />

With/Without<br />

Transaction<br />

With/Without<br />

Transaction<br />

With/Without<br />

Transaction<br />

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

300<br />

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

300<br />

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

300<br />

Database<br />

provider<br />

SQL Server<br />

SQL Server<br />

SQL Server<br />

SQL Server<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 call the CreateDatabase method and create any other objects, such<br />

as a DbCommandWrapper, that the application block uses to execute a query. For an<br />

example of how to create a domain object for each iteration, see Using the <strong>Test</strong> Script.<br />

Create a Web page to run the test harness.<br />

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

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

shown here. The <strong>Enterprise</strong> <strong>Library</strong> uses one version and ADO.NET uses the other<br />

version. <strong>Enterprise</strong> <strong>Library</strong> 1.1 was also used to establish a baseline. Its database<br />

methods differ slightly from the methods in <strong>Enterprise</strong> <strong>Library</strong>–January 2006. The<br />

<strong>Enterprise</strong> <strong>Library</strong> 1.1 code is not shown. The only scenario used for baseline comparisons<br />

was scenario 5.<br />

When the application block executes the scenarios within a transaction, it creates a<br />

connection object and retrieves a transaction object. Then, the application block uses<br />

the appropriate method overload for working with transactions.<br />

Table 12 lists the Data Access Application Block test code.

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

Saved successfully!

Ooh no, something went wrong!