Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rhino mocks telling me Arg<T> inside AssertWasCalled needs more arguments?

here's the call inside a [Test]

_youTubeService.AssertWasCalled(d => d.GetFeedByAuthorWithRequest("Mark", Arg<YouTubeRequest>.Is.Anything));

here's the function on the interface for youtubeService:

Feed<Video> GetFeedByAuthorWithRequest(string author, YouTubeRequest request)

Here's the error Rhino Mocks gives me when I run the test:

System.InvalidOperationException : When using Arg, all arguments must be defined using Arg.Is, Arg.Text, Arg.List, Arg.Ref or Arg.Out. 2 arguments expected, 1 have been defined.

I use Arg.Is.Anything all the time with other types, usually strings, so I'm not sure what else it needs.

like image 439
Mark W Avatar asked Feb 14 '12 22:02

Mark W


1 Answers

The exception message tells you what's wrong: all arguments must be defined using Arg....

You need to specify the argument "Mark" using Arg.Is or Arg.Text or some other static Arg method.

like image 152
phoog Avatar answered Nov 10 '22 00:11

phoog