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.

106<br />

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

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

Verify that, for<br />

a specific instance<br />

name,<br />

the application<br />

block only<br />

creates one<br />

instance of<br />

a class that<br />

derives from<br />

the Security-<br />

CacheProvider<br />

class or that<br />

implements<br />

the ISecurity-<br />

CacheProvider<br />

interface.<br />

Yes<br />

The SecurityCacheFactory class creates instances of classes<br />

that derive from the SecurityCacheProvider class as well as<br />

instances of classes that implement the ISecurityCacheProvider<br />

interface. It does this by calling the SecurityCacheProviderFactory<br />

class. The SecurityCacheProviderFactory class<br />

derives from the LocatorNameTypeFactoryBase. This class<br />

creates a single instance of the provider for the given instance<br />

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

public class SecurityCacheProviderFactory : Locator<br />

NameTypeFactoryBase{}<br />

Verify that an<br />

assembler<br />

class that<br />

implements<br />

the IAssembler<br />

interface<br />

creates the<br />

authorization<br />

providers and<br />

the security<br />

cache providers<br />

and injects<br />

the configuration<br />

object<br />

values into<br />

those domain<br />

objects.<br />

Yes<br />

The following code demonstrates how the AuthorizationRuleProviderAssember<br />

class, which implements the IAssembler<br />

interface, creates an AuthorizationRuleProvider object. The<br />

process is similar for creating AzmanAuthorizationProvider<br />

objects and CachingStoreProvider objects.<br />

public class AuthorizationRuleProviderAssembler :<br />

IAssembler<br />

{<br />

public IAuthorizationProvider<br />

Assemble(IBuilderContext context, AuthorizationProviderData<br />

objectConfiguration, IConfigurationSource<br />

configurationSource, ConfigurationReflectionCache reflectionCache)<br />

{<br />

…<br />

IAuthorizationProvider createdObject= new Authoriza<br />

tionRuleProvider(authorizationRules);<br />

return createdObject;<br />

}<br />

}

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

Saved successfully!

Ooh no, something went wrong!