Day: April 25, 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[] { }); //…