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 39<br />

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

Verify that custom Passed In the following test case, the MockBackingStore class is<br />

backing stores<br />

a custom backing store that implements the IBackingStore<br />

can be added<br />

interface. The following is the configuration information for<br />

to the application<br />

block and<br />

<br />

the custom backing store.<br />

configured from<br />

<br />

<br />

<br />

<br />

<br />

The following is the MockBackingStore class.<br />

[ConfigurationElementType(typeof(CustomCacheStorage<br />

Data))]<br />

public class MockBackingStore : IBackingStore<br />

{<br />

public static NameValueCollection attributes;<br />

public static int count;<br />

public MockBackingStore(NameValueCollection attributes)<br />

{<br />

MockBackingStore.attributes = attributes;<br />

}<br />

public int Count<br />

{<br />

get { return count; }<br />

}<br />

public void Add(CacheItem newCacheItem)<br />

{<br />

count++;<br />

}<br />

public void Remove(string key)<br />

{<br />

count--;<br />

}<br />

public void UpdateLastAccessedTime(string key, DateTime<br />

timestamp){}<br />

public void Flush()<br />

{<br />

count = 0;<br />

}<br />

public Hashtable Load()<br />

continued

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

Saved successfully!

Ooh no, something went wrong!