I have a method that I want to make fun of that takes an array as an argument. In a real call, the method will modify this array, and the resulting array will be used later in the code. What I was trying to do was pass the array into a laughed method call that would have values that would be valid when the array was used again. However, what I find is that when the call is made with the mocked method, it does not use the array that I defined when setting up the layout, instead using the original array. Is there any way around this problem.
eg
public interface ITest
{
int Do(int[] values);
}
public void MyTest
{
var testMock = new Mock<ITest>();
int[] returnArray = new int[] {1,2,3};
testMock.Setup(x => x.Do(returnArray)).Returns(0);
MyTestObject obj = new MyTestObject();
obj.TestFunction(testMock.Object);
}
public class MyTestObject
{
.....
public void TestFunction(ITest value)
{
int [] array = new int[3];
value.Do(array);
if (array[0] == 1)
, - , , i, mocked method. , , , , . RhinoMocks, .
,
Kev