Expect.Call

4 views
Skip to first unread message

Martinb

unread,
Jun 10, 2008, 1:47:52 PM6/10/08
to Rhino.Mocks
I am having an error with the code below on the Expect.Call line I get
the error Invalid call, the last call has been used or no call has
been made I have I have checked to make sure that the method I am
calling is virtual.

MockRepository mocks = new MockRepository();
ADUtility _ADUtility =
mocks.CreateMock<ADUtility>("","","");
ManageAlerts _ManageAlerts = new ManageAlerts();
_ManageAlerts.ADUtil = _ADUtility;

ADPerson person = new ADPerson();
ADPerson person2 = new ADPerson();
List<ADPerson> people = new List<ADPerson>();
people.Add(person);
people.Add(person2);

Expect.Call(_ADUtility.GetUsersFromNamedGroup("")).Return(people);

Any ideas?

Gustavo Ringel

unread,
Jun 10, 2008, 1:54:04 PM6/10/08
to Rhino...@googlegroups.com
maybe the code inside GetUsers is reacting bad to the "" stuff...
try IgnoreArguments() before the return if you don't mind about the arguments you are sending.
 
Gustavo.

Ayende Rahien

unread,
Jun 10, 2008, 2:56:07 PM6/10/08
to Rhino...@googlegroups.com
Is it possible that the setter for ADUtil does soething?

Martinb

unread,
Jun 10, 2008, 3:19:51 PM6/10/08
to Rhino.Mocks
The constructor for ADUtil sets some internal fields (username, domain
etc). Do you think I might need to use IgnoreArgument here also?
> > Any ideas?- Hide quoted text -
>
> - Show quoted text -

Martinb

unread,
Jun 10, 2008, 3:20:12 PM6/10/08
to Rhino.Mocks
Thanks I will try this.

Martinb

unread,
Jun 11, 2008, 3:47:07 AM6/11/08
to Rhino.Mocks
Thanks guys, this seems to have been a developer error on my part!

I had forgotton that the ADUtil assembly had been Gac'ed. SO whilst I
was franctically making chages to my local assembly it was never being
loaded.

Thanks again.
> > - Show quoted text -- Hide quoted text -
Reply all
Reply to author
Forward
0 new messages