C
Chris Marsh
All
In order to facilitate more effective unit testing for .aspx and .ascx
items, I am using the MVP pattern. I therefore have the following entities:
interface IMyPageView
class MyPagePresenter
class MyPage
Interface IMyPageView defines events.
Class MyPagePresenter accepts an object of type IMyPageView through its
constructor, and subscribes to the object's events.
Class MyPage implements IMyPageView, and invokes the required events in the
appropriate places. It also creates an instance of MyPagePresenter, passing
itself (MyPage) through the constructor.
All of this works fine; I'm satisfied that it effectively seperates
concerns, and the code is simple and maintainable. However, FXCop complains
that the variable within MyPage used to hold the reference to the instance
of MyPagePresenter is never assigned to. I am obliged to fix all FXCop
errors and warnings, and I cannot exclude any of them. Can anyone suggest
how I may circumvent this issue whilst maintaining this model and satisfying
FXCop?
The line causing FXCop problems within MyPage is:
MyPagePresenter presenter = new MyPagePresenter (this);
Many thanks in advance for your assistance in this matter!
In order to facilitate more effective unit testing for .aspx and .ascx
items, I am using the MVP pattern. I therefore have the following entities:
interface IMyPageView
class MyPagePresenter
class MyPage
Interface IMyPageView defines events.
Class MyPagePresenter accepts an object of type IMyPageView through its
constructor, and subscribes to the object's events.
Class MyPage implements IMyPageView, and invokes the required events in the
appropriate places. It also creates an instance of MyPagePresenter, passing
itself (MyPage) through the constructor.
All of this works fine; I'm satisfied that it effectively seperates
concerns, and the code is simple and maintainable. However, FXCop complains
that the variable within MyPage used to hold the reference to the instance
of MyPagePresenter is never assigned to. I am obliged to fix all FXCop
errors and warnings, and I cannot exclude any of them. Can anyone suggest
how I may circumvent this issue whilst maintaining this model and satisfying
FXCop?
The line causing FXCop problems within MyPage is:
MyPagePresenter presenter = new MyPagePresenter (this);
Many thanks in advance for your assistance in this matter!