Mocking out and ref parameters with Rhino Mocks
Today I learned that you can mock out and ref parameters with the following syntax in Rhino Mocks.
/* Arrange */
mock.Expect(rep => rep.FindByTitle(Arg<string>.Is.Anything, out Arg<int>.Out(10).Dummy))
.Return(new List<Book>());
/* Act */
var count = 0;
var books = bookFinder.FindBooks("hitchhikers guide to the galaxy", out count);
/* Assert */
Assert.AreEqual(10, count);
}
comments powered by Disqus