RajOpteamix / moq

Automatically exported from code.google.com/p/moq
Other
0 stars 0 forks source link

Method calls with out parameters cannot be verified #354

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
When I try to verify a call to a method that takes an out parameter, Moq always 
throws a VerificationException, reporting that the method was not called.

var mock = new Mock<Foo>(); // Foo has method DoSomething(out int)
int result;
mock.Object.DoSomething(out result);
mock.Verify(x => x.DoSomething(out result));

I also attempted to use strict behavior and provide a Setup call as described 
in the quick start, with the same result:

var mock = new Mock<Foo>(MockBehavior.Strict);
int result = 5;
mock.Setup(x => x.DoSomething(out result));
mock.Object.DoSomething(out result);
mock.Verify(); // VerificationException

Original issue reported on code.google.com by br...@control-v.net on 21 Nov 2012 at 12:10