Mark W
Mark W

Reputation: 3909

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.

Upvotes: 6

Views: 4145

Answers (1)

phoog
phoog

Reputation: 43076

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.

Upvotes: 10

Related Questions