Hello,
Iam having very weird problem. I searched through web and couldnt find any
solution. I found something similar here:
https://www.mail-archive.com/[email protected]/msg00656.html
but it didnt help in my case.
public interface IConnectionDecorator
{
ResultType RunWithDecorator<ResultType>(IDbCommand cmd,
Func<IDbCommand, ResultType> f);
}
public class TransactionDecorator : IQueryResultDecorator
{
private readonly IConnectionDecorator connectionDecorator;
public TransactionDecorator(IConnectionDecorator connectionDecorator)
{
this.connectionDecorator = connectionDecorator;
}
public QueryResult<ResultType> RunWithDecorator<ResultType>(IDbCommand
cmd, Func<IDbCommand, ResultType> func)
{
return connectionDecorator.RunWithDecorator(cmd, c =>
withTransaction(c, func));
}
private QueryResult<ResultType> withTransaction<ResultType>(IDbCommand
c, Func<IDbCommand, ResultType> f)
{
}
}
I try to mock it like this:
var conDec = MockRepository.GenerateMock<IDbConnection>();
conDec.Stub(a => a.RunWithDecorator(cmd, c =>
2)).IgnoreArguments().Do((Func<IDbCommand, Func<IDbCommand, int>, int>)((c,
fun) =>
{
fun(c);
throw new Exception();
return 2;
}));
and when I call TransactionDecorator.RunWithDecorator my stubbed function
is not called. Funny thing is that if I put something else instead of c=>
withTransaction(c, func) in argument, everything works fine. Is it me doing
something wrong or its some sort of bug ?
Regards,
Qba
--
You received this message because you are subscribed to the Google Groups
"Rhino.Mocks" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/rhinomocks.
For more options, visit https://groups.google.com/d/optout.