質問

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!");
役に立ちましたか?

解決

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

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top