Search code examples
c#mockingrhino-mocks

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.


Solution

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