Unit testing an HttpApplication

后端 未结 3 1963
天涯浪人
天涯浪人 2020-12-31 10:45

I have a class derived from HttpApplication that adds some extra features. I\'m to the point where I need to unit test these features, which means I have to be able to creat

3条回答
  •  心在旅途
    2020-12-31 11:32

    IMHO adding a functionality by extending HttpApplication is not the best thing to do. It is so difficult to mock the HttpContext because of the private/internal/sealed classes that even if you succeed your unit tests will be so cluttered with mocking code that you will no longer be able to understand what you are actually testing.

    Could you give more details on what functionality you are adding? Maybe there's a better way of adding this functionality to your application.

提交回复
热议问题