I have a helper method to setup my Expect statement. The helper
method takes an array of SqlParameters. I've tried just about
everything to get the method stub to return a specific value (entity)
when a certain set of SqlParameters are passed in. I know the below
is not going to work because the SqlParameter[] items passed in are
not the same objects as are being past to the mock object although
their order, type and value are all identical.
private static void ExecuteEntityMock<T>(
T entity,
string sql,
params SqlParameter[] cmdParams)
{
iSqlHelper.Expect(mp => mp.ExecuteEntity<T>(
Arg<String>.Is.Anything,
Arg<CommandType>.Is.Anything,
Arg.Text.Contains(sql),
Arg<SqlParameter[]>.List.Equal(cmdParams))) // Doesn't work
.Repeat.Once()
.Return(entity);
}
I've been struggling with some of the documentation recently and feel
that I'm getting very close but just cannot get it to work correctly.
I am working with .NET 3.5 so I do have the option to use Lambda
expressions but am struggling with getting that mechanism to work as
well.
Basically, I'd like to return a specific entity when I pass a list of
SqlParameter objects (one parameter in my most simple test) that have
the same properties but are not the same objects. I'm probably just
missing something simple. Thanks in advance.
--
You received this message because you are subscribed to the Google Groups
"Rhino.Mocks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rhinomocks?hl=en.