A quick tip here, we've just spent what felt like ages trying to Stub a method with a ref parameter using RhinoMocks, you'll also need NUnit for the code below to work.
The problem we had was for the .Ref() method we needed an AbstractContraint but the normal Is.Anything didn't work, but if you use: Rhino.Mocks.Constraints.Is.Anything() it works fine.
RhinoMocks Stub with a Ref Parameter Example
using NUnit.Framework;
using Rhino.Mocks;
namespace RhinoRef
{
[TestFixture]
public class RhinoMockRefTests
{
[Test]
public void Should_be_able_to_stub_a_ref_parameter_in_rhino_mocks()
{
var repo = MockRepository.GenerateStub();
repo.Stub(r => r.Get(Arg.Is.Anything, ref Arg.Ref(Rhino.Mocks.Constraints.Is.Anything(), 0).Dummy))
.Return("StubQuestion");
int theAnswer = 42;
var theQuestion = repo.Get("anything", ref theAnswer);
Assert.That(theQuestion,Is.EqualTo("StubQuestion"));
}
}
public interface IGetThingsOutOfTheDatabase
{
string Get(string name, ref int awkwardParameter);
}
}