[TestClass]
public class UnitTest1
{
public Array sample;
public Array copyTheArray( ref Array array1)
{
sample= array1;
return sample;
}
public bool checkTheArray(Array array1, Array array2)
{
var dummy1 = copyTheArray(ref array1);
var dummy2 = copyTheArray(ref array2);
if (sample.Equals(array1))
{
return true;
}
else
{
return false;
}
}
[TestMethod]
public void TestcheckTheArray()
{
string[] sample1 = new string[] { "t", "s" };
string[] sampleGroup = new string[]{"ts","pr","tp"};
string[] sampleOriginal = new string[]{"p","s"};
Array dummySample = null;
sample = sampleOriginal;
using (RecordExpectations recorder = new RecordExpectations())
{
recorder.DefaultBehavior.RepeatAlways();
copyTheArray(ref dummySample);
recorder.Return(sample);
}
var returnValue = checkTheArray(sample1, sampleGroup);
}
}
}
while running the above test, the second call to copyTheArray throws the exception
TypeMock Verification: Call to _2849.UnitTest1.copyTheArray() Parameter: 1
expected: <"2 items">
but was: <3>
1) Could anyone explain what is happening here? I undestand that the exception is for sending a different number of paramater, but I have'nt set the expected behavior to be like that.
2) what should be done to make the code to return the same value as like the one set in the recording block?
NB:- Please dont ask to use the new Typemock API as only this test case is failing and all other test are implemented with natural mocks.
Also this test start failing after update to 8.1.11