public class stubBaseTx : BaseTxFlowOperations
{
private MockRepository mocks;
private ITransaction mockITransaction;
public stubBaseTx()
{
mocks = new Rhino.Mocks.MockRepository();
mockITransaction = mocks.DynamicMock<ITransaction>();
mocks.ReplayAll();
}
protected override ITransaction FlowProperty_Transaction
{
get
{
return mockITransaction;
}
}
}
public class StubWithdrFlowISONet :WithdrawalFlowISONet
{
private MockRepository mocks;
private bool FlowProperty_PINReAv = false;
public StubWithdrFlowISONet()
{
mocks = new Rhino.Mocks.MockRepository();
mocks.ReplayAll();
stubBaseTx obj = new stubBaseTx();
base.CreateCRMManager();
}
protected override bool FlowProperty_PINRetriesAvailable
{
get
{
return FlowProperty_PINReAv;
}
}
}
这里WithdrawalFlowISONet来自WithdrawalFlowOperation类,而WithdrawalFlowOperation来自BaseTxFlowOperations类,现在我有FlowProperty_Transaction BaseTxFlowOperations中的属性,我必须传递给WithdrawalFlowISONet类,但它是readonly,只能在BaseTxFlowOperations中修改,现在我创建了stubBaseTx类,只是为了修改FlowProperty_Transaction 属性,那么如何将stubBaseTx类分配给WithdrawalFlowISONet类,以便它可以作为WithdrawalFlowISONet类的基础。 [C#] 谢谢, NISHANT