public interface IService
{
void DoSomething(ref string a);
void DoSomething2(out string a);
}
[TestMethod]
public void TestRefPara()
{
var service = new Mock<IService>();
service.Setup(s => s.DoSomething(ref It.Ref<string>.IsAny));
string actualValue= "value";
service.Object.DoSomething(ref actualValue);
Assert.AreEqual("value", actualValue);
}
[TestMethod]
public void TestOutPara()
{
var service = new Mock<IService>();
string outPara = "abc";
string actualValue = "value";
service.Setup(s => s.DoSomething2(out outPara));
service.Object.DoSomething2(out actualValue);
Assert.AreEqual("abc", actualValue);
}