Welcome to Typemock Answers. Here you can ask and receive answers from other community members. And if you liked or disliked an answer or thread: react with an up- or downvote Enjoy!

Typemock.Verification exception on parameter passed after update from 6.0.8 to 8.1.11

0 votes
[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
 
 
 

 

asked May 13, 2016 by thomasjohnaj (160 points)

1 Answer

0 votes
Thanks for reporting, this has been fixed and will be part of our next release
answered Jun 2, 2016 by eli (5,770 points)
...