0

i refer to this article from Peter Provost:

Visual Studio 2012 Fakes - Part 3 - Observing Stub Behavior

The question is if and how can i verify if the method is called with a defined parameter? For example somthing like that:

var wasCalled = observer.GetCalls().Any(call => call.StubbedMethod.Name == methodName && call.StubMethod.Parameter == "Hello there!");
exception
  • 223
  • 1
  • 4
  • 10

1 Answers1

0

I think this is what you need.

var wasCalled = observer.GetCalls().Any(call => call.StubbedMethod.Name == methodName && (string)call.GetArguments() == "Hello there!");

HTH Patrick Tseng Microsoft ALM team

Patrick Tseng
  • 264
  • 1
  • 1