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.

<strong>Test</strong>ing the Application Block 35<br />

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

Verify that the database<br />

backing store uses a<br />

named instance of the<br />

store and uses the Data<br />

Access Application Block to<br />

create that instance.<br />

Verify that the application<br />

block can use an instance<br />

name to create a CacheManager<br />

object.<br />

Verify that the application<br />

block can use a default<br />

instance name to create a<br />

CacheManager object.<br />

Yes<br />

Yes<br />

Yes<br />

The ObjectBuilder subsystem uses the Data Access<br />

Application Block to create the Database<br />

instance that is the database backing store.<br />

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

public class DataBackingStoreAssembler<br />

: IAssembler<br />

{<br />

public IBackingStore Assemble(…)<br />

{<br />

…<br />

Data.Database database = (Data.<br />

Database)context.HeadOfChain.BuildUp(c<br />

ontext,typeof(Data.Database), null,cas<br />

tedObjectConfiguration.DatabaseInstance-<br />

Name);<br />

IBackingStore createdObjet<br />

= new DataBackingStore(database,castedO<br />

bjectConfiguration.PartitionName,encrypt<br />

ionProvider);<br />

}<br />

}<br />

The following configuration example shows how<br />

the database instance name is configured in<br />

the configuration source.<br />

<br />

<br />

The CacheManager.GetCacheManager method<br />

has two overloads. One of them includes an<br />

instance name as a parameter to create a specific<br />

CacheManager object. This is shown in the<br />

following code example.<br />

public static CacheManager<br />

GetCacheManager(string cacheManager-<br />

Name){}<br />

The CacheManager.GetCacheManager method<br />

has two overloads. One of them creates a<br />

default CacheManager object. This is shown in<br />

the following code example.<br />

public static CacheManager GetCacheManager(){}<br />

continued

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

Saved successfully!

Ooh no, something went wrong!