• Post Calendar

    April 2010
    S M T W T F S
    « Mar   May »
     123
    45678910
    11121314151617
    18192021222324
    252627282930  

Archive for April 25th, 2010


Unit Test Authorize Attribute

Technorati Tags: Unit Testing,ASP.NET,MVC,VS 2010 Story: I want to write a unit test to ensure that the Authorize attribute is applied to a controller ActionResult or ViewResult so that security is tested. Here is the test: Unit Test [TestMethod] public void PreviousSiteUserConversion_Authorization_Attributes_Have_Been_Applied() {     // Arrange     MethodInfo varietalMethod = typeof(AdminController).GetMethod("PreviousSiteUserConversion", new Type[] { });       // [...]