WorkItem.InitializeWorkItem null parent exception

Topics: CAB & Smart Client Software Factory
Dec 3, 2005 at 3:28 PM
originally posted by: jdressel

I understand it's intended to be an injection method to be called by the Parent (as per the code comment) but it looks like it can only be called by the parent because you'll get a null parent reference in the InitializeFields() method and it does not make sense to call it more than once. Should this be protected and called only when the Parent is injected?

Discovered because I need an intialized WorkItem as a container in my unit tests. I tried to initialize the workitem using the InitializeWorkItem(), but failed on the null parent reference. I have since discovered the TestableRootWorkitem in the CAB's unit tests. I will follow a similar approach.