Let me see if I understand you correcctly ...

1.  securityService.Stub(s => s.ValidateUser("UserName",
"WrongPassword")).Return(false);

    you want a return value of false when the username and password
above are used

2. securityService.Stub(s => s.ValidateUser(String.Empty,
String.Empty)).IgnoreArguments().Return(true);

    you want a return value of true when any other username and
password are given


===============

the problem is that you have told Rhino Mocks to IgnoreArguments() and
Return(true) .... so that is what it will always do (as far as my
understanding goes)



On Jan 28, 1:43 am, Changhong Fu <[email protected]> wrote:
> Sorry, in my previous message, it supposed to be "When arguments
> "UserName"/"*WrongPassword*" are used, it will return false..."
>
>
>
> On Thu, Jan 28, 2010 at 12:40 PM, changhong <[email protected]> wrote:
> > Does any one know if I can override an expectation?
>
> > for example: If I set up 2 expectations with different arguments
>
> > securityService.Stub(s => s.ValidateUser(String.Empty,
> > String.Empty)).IgnoreArguments().Return(true);
>
> > securityService.Stub(s => s.ValidateUser("UserName",
> > "WrongPassword")).Return(false);
>
> > When arguments "UserName"/"Password" are used, it will return false,
> > otherwise it will return true.
> > This is kind of the expectation with better Argument match overrides
> > the other one.
>
> > I don't think Rhino.Mocks can do it, but please correct me if I am
> > wrong. And anyone thinks this is an useful feature?
>
> > --
> > 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]<rhinomocks%2bunsubscr...@googlegrou­ps.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/rhinomocks?hl=en.- Hide quoted text -
>
> - Show quoted text -

-- 
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.

Reply via email to