Case insensitive expectations in Rhino Mocks
- by user313886
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?