Case insensitive expectations in Rhino Mocks
Posted
by user313886
on Stack Overflow
See other posts from Stack Overflow
or by user313886
Published on 2010-04-11T11:58:42Z
Indexed on
2010/04/11
12:03 UTC
Read the original article
Hit count: 212
rhino-mocks
|case
I'm using Rhino Mocks to expect a call. There is a single parameter which is a string. But I'm not bothered about the case of the string. I want the test to pass even if the case is wrong. So I'm doing the following:
//expect log message to be called with a string parameter.
//We want to ignore case when verifiyig so we use a constraint instead of a direct parameter
Expect.Call(delegate { logger.LogMessage(null); }).Constraints(Is.Matching<string>(x => x.ToLower()=="f2"));
It seems a bit log winded. Is there a more sensible way of doing this?
© Stack Overflow or respective owner