Wednesday, August 31, 2011

a test I broke

We have a test that starts out like so:

[TestMethod]

public void FooControllerViewAllActionSecurityTest()

{

   var actionName = "Index";

   var controller = new FooController();

   var type = controller.GetType();

   var authAttribute = GetAuthorizedRolesAttribute(type, actionName, new Type[] {

         typeof(FooModel), typeof(BarModel), typeof(int))

      });

 
 

...which does a few other complicated things to test security. Some of it is done by GetAuthorizedRolesAttribute which expects the appropriate parameters for an action method's definition to be handed into it. The test fails if the wrong parameters are handed in. I broke this test yesterday, but fixed it today.

No comments:

Post a Comment