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.

116<br />

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

<strong>Test</strong> case Result Automated test<br />

Verify that a<br />

CachingStoreProvider<br />

object can<br />

add an identity to<br />

the cache and retrieve<br />

an identity<br />

from the cache.<br />

Passed This test uses information in the configuration store to create<br />

a secure cache provider. It then uses the cache provider first to<br />

save an identity to the cache and then to retrieve an identity from<br />

the cache.<br />

The following is the configuration information.<br />

<br />

<br />

<br />

The following is the test.<br />

[<strong>Test</strong>Method]<br />

public void DBAddIdentity<strong>Test</strong>()<br />

{<br />

ISecurityCacheProvider securityCache = SecurityCache-<br />

Factory.GetSecurityCacheProvider("CacheProviderDB");<br />

Assert.IsNotNull(securityCache);<br />

IToken token = securityCache.SaveIdentity(identity);<br />

Assert.IsNotNull(token);<br />

Assert.IsNotNull(token.Value);<br />

IIdentity cachedIdentity = securityCache.<br />

GetIdentity(token);<br />

Assert.IsNotNull(cachedIdentity);<br />

Assert.AreEqual(cachedIdentity.Name, "testuser");<br />

}

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

Saved successfully!

Ooh no, something went wrong!