I have a Data Access Object TransactionDao. When you call TransactionDao.Save(transaction) I would like for it to setting a transaction.IsSaved=true flag (this is a simplification the actual thing I'm trying to do is not quite so banal). So when mocking my TransactionDao with RhinoMocks how can I indicate that it should transform its input?
Ideally I would like to write something like this:
Expect.Call(delegate {dao.Save(transaction);}).Override(x => x.IsSaved=true);
Does anyone know how to do this?
Though I got a hint how to do it from the answer specified below the actual type signature is off, you have to do something like this: Because of what Mark Ingram posted, seems like the best answer, though nobody's explicitly said it, is to do this:
public delegate void FakeSave(Transaction t);
...
Expect.Call(delegate {dao.Save(t); }).Do( new FakeSave(delegate(Transaction t2) { t.IsSaved = true; }));