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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

112<br />

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

Using Automated <strong>Test</strong>s<br />

Automated tests ensure that the application block functions in accordance with its<br />

requirements. Automated tests make regression testing easier and certain tests, such<br />

as simulating a large number of users to test a multithreading scenario, require automation.<br />

Table 5 lists the Visual Studio Team System tests that were used with the Security<br />

Application Block.<br />

Table 5: Visual Studio Team System <strong>Test</strong>s for the Security Application Block<br />

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

Verify that the<br />

application block<br />

throws the appropriate<br />

exception<br />

when it receives<br />

invalid data.<br />

Passed The following test supplies an invalid instance name to the Get-<br />

AuthorizationProvider name, which causes the application block<br />

to throw the ConfigurationErrorsException exception.<br />

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

[ExpectedException(typeof(ConfigurationErrorsException<br />

))]<br />

public void CreateInvalidAuthRuleProviderFromConfig-<br />

File()<br />

{<br />

IAuthorizationProvider authRuleProvider = AuthorizationFactory.GetAuthorizationProvider("InvalidRule");<br />

}

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

Saved successfully!

Ooh no, something went wrong!