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.

256<br />

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

Solution<br />

The SaveProfile, SaveIdentity, and SavePrincipal methods on the Security-<br />

CacheProvider class were modified to check the input values and to throw exceptions<br />

if they were null. The following is the modified SaveProfile method.<br />

public override IToken SaveProfile(object profile)<br />

{<br />

if (profile == null)<br />

{<br />

throw new ArgumentNullException("profile");<br />

}<br />

…<br />

}<br />

Verification<br />

Running the test case again after applying the preceding code verified that the cache<br />

threw the ArgumentNullException exception when the input value was null.

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

Saved successfully!

Ooh no, something went wrong!