IgnoreArguments() on only one of two params

346 views
Skip to first unread message

Tim Barcz

unread,
Aug 22, 2008, 4:13:04 PM8/22/08
to Rhino...@googlegroups.com
If I have an object Cryptographer that has a method HashString(string stringToHash, string salt)

I have a call like the following...

SetupResult.For(mockCryptographer.HashString(email, null)).IgnoreArguments()

but I would really like to do something like

SetupResult.For(mockCryptographer.HashString(email, null)).IgnoreArguments(Position.Second)

The reason being is that the component has the salt defined already.  So all I supply to the method I'm testing is an email.  I want to ensure that the cryptographer is being called with the proper email.

It is it possible to just ignore one argument?

Tim

Ayende Rahien

unread,
Aug 22, 2008, 4:20:22 PM8/22/08
to Rhino...@googlegroups.com
Constraints(Is.Equals(foo), Is.Anything())

Tim Barcz

unread,
Aug 22, 2008, 4:17:16 PM8/22/08
to Rhino...@googlegroups.com
The SetupResult.For should be Expect.Call

Other than the the question still is the same.

Tim Barcz

unread,
Aug 22, 2008, 4:22:11 PM8/22/08
to Rhino...@googlegroups.com
does .Constraints match on positions....

where (in your example)

Is.Equals(foo) puts a constraint on the first param and
Is.Anything puts a constraint on the third?

Ayende Rahien

unread,
Aug 22, 2008, 4:35:56 PM8/22/08
to Rhino...@googlegroups.com
yes

Tim Barcz

unread,
Aug 22, 2008, 4:36:24 PM8/22/08
to Rhino...@googlegroups.com
You're a stud.

Chris Martin

unread,
Aug 23, 2008, 1:21:04 AM8/23/08
to Rhino...@googlegroups.com
lmfao! ;)

Dave East

unread,
Aug 7, 2012, 9:30:28 PM8/7/12
to rhino...@googlegroups.com, Rhino...@googlegroups.com
Small typo here, it should be:

Constraints(Is.Equal(foo), Is.Anything()) 
Reply all
Reply to author
Forward
0 new messages