I'm pretty new to mocking so this might be something I'm just not picking up on yet, but I can't find a good example anywhere.
I'm trying to assert that by default, any class that inherits from my abstract class will instantiate a collection in the constructor. Here's the abstract class:
public abstract class DataCollectionWorkflow : SequentialWorkflowActivity
{
private readonly DataSet _output = new DataSet();
private List<DataCollectionParameter> _params = null;
public DataCollectionWorkflow()
{
_params = new List<DataCollectionParameter>();
}
public virtual IList<DataCollectionParameter> Parameters
{
get { return _params; }
set { _params = (List<DataCollectionParameter>)value; }
}
}
How do I mock this with Rhino? If I do a GenerateMock<DataCollectionWorkflow>
(or a stub), the constructor runs and the mock's private field "_params
" gets initialized, but the mock's "Parameters
" property is simply null.
Obviously the generated mock subclass is overriding the property implementation. Is there some way of excluding the Parameters property from being re-implemented?
Thanks.