Unit test class inherited from ContextBoundObject and decorated with ContextAttribute
        Posted  
        
            by Joel Cunningham
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Joel Cunningham
        
        
        
        Published on 2010-04-07T23:52:41Z
        Indexed on 
            2010/04/08
            0:33 UTC
        
        
        Read the original article
        Hit count: 497
        
I am trying to retrofit unit tests on to some existing code base. Both the class and method I want to unit test is decorated with custom attributes that are inherited from ContextBoundObject and ContextAttribute. I dont want them to run as part of the unit test.
The only solution I have come up with is to compile the attribute out when I want to unit test. I dont really like this solution and would prefer to either replace it with a mocked attribute at runtime or prevent the attribute from running in a more elegant way.
How do you unit test code that has class and method attributes that inherit from ContextBoundObject and ContextAttribute that you dont want to run as part of a unit test?
Thanks in advance.
© Stack Overflow or respective owner