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 27<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 Caching Application Block.<br />

Table 4: Caching Application Block Code Verification<br />

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

Verify that the application<br />

block creates only one<br />

CacheManager instance for<br />

the given instance name.<br />

Verify that assembler<br />

classes that implement the<br />

IAssembler interface create<br />

the backing store providers<br />

and the encryption providers,<br />

and inject the configuration<br />

object values into<br />

those domain objects.<br />

Yes<br />

Yes<br />

The CacheManagerFactory class creates a<br />

CacheManager instance. The CacheManager-<br />

Factory class derives from the LocatorName-<br />

TypeFactoryBase class. This class creates only<br />

one instance for a given instance name.<br />

The following code demonstrates how the<br />

DataBackingStoreAssembler class, which<br />

implements the IAssembler interface, creates a<br />

backing store.<br />

public class DataBackingStoreAssembler<br />

: IAssembler<br />

{<br />

public IBackingStore Assemble(…)<br />

{<br />

IBackingStore createdObjet = new Data-<br />

BackingStore(…);<br />

return createdObjet;<br />

}<br />

}<br />

The following code demonstrates how the SymmetricStorageEncryptionProviderAssembler,<br />

which implements the IAssembler interface,<br />

creates a symmetric encryption provider.<br />

public class SymmetricStorageEncryptionProviderAssembler<br />

: IAssembler<br />

{<br />

public IStorageEncryptionProvider Assemble(…)<br />

{<br />

IStorageEncryptionProvider createdObject<br />

= new SymmetricStorageEncryptionPr<br />

ovider(symmetricCrytoProvider);<br />

return createdObject;<br />

}<br />

}<br />

continued

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

Saved successfully!

Ooh no, something went wrong!