Hi,
I've got the following bit of code. Where assign does not work
namespace UnitTests
{
public static class MyClass
{
public static void Method(String param)
{
param = "not set";
}
}
public class Caller
{
public void Call()
{
String b = "bye";
MyClass.Method(b);
}
}
[TestFixture]
public class tests
{
[Test]
public void test()
{
Mock myMock = MockManager.Mock(typeof(MyClass), Constructor.StaticNotMocked);
myMock.ExpectCall("Method").Args(new Assign("hello"));
Caller a = new Caller();
a.Call();
}
}
}
If I make the parameter
param explicitly a ref then it works. Eg. When the code is
namespace UnitTests
{
public static class MyClass
{
public static void Method(ref String param)
{
param = "not set";
}
}
public class Caller
{
public void Call()
{
String b = "bye";
MyClass.Method(ref b);
}
}
[TestFixture]
public class tests
{
[Test]
public void test()
{
Mock myMock = MockManager.Mock(typeof(MyClass), Constructor.StaticNotMocked);
myMock.ExpectCall("Method").Args(new Assign("hello"));
Caller a = new Caller();
a.Call();
}
}
}
Anyone know why you have to explicitly set ref on the parameters if using assign, as I thought that all reference objects should be passed as reference anyway?